1 /* 2 (C) Copyright IBM Corp. 2007, 2009 3 4 THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE 5 ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 6 CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. 7 8 You can obtain a current copy of the Eclipse Public License from 9 http://www.opensource.org/licenses/eclipse-1.0.php 10 11 @author : Alexander Wolf-Reber, IBM, a.wolf-reber@de.ibm.com 12 * 13 * Change History 14 * Flag Date Prog Description 15 *------------------------------------------------------------------------------- 16 * 1678915 2007-03-29 lupusalex Integrated WBEM service discovery via SLP 17 * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL 18 * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) 19 */ 20 21 package org.metricshub.wbem.sblim.cimclient.discovery; 22 23 /*- 24 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ 25 * WBEM Java Client 26 * ჻჻჻჻჻჻ 27 * Copyright 2023 - 2025 MetricsHub 28 * ჻჻჻჻჻჻ 29 * Licensed under the Apache License, Version 2.0 (the "License"); 30 * you may not use this file except in compliance with the License. 31 * You may obtain a copy of the License at 32 * 33 * http://www.apache.org/licenses/LICENSE-2.0 34 * 35 * Unless required by applicable law or agreed to in writing, software 36 * distributed under the License is distributed on an "AS IS" BASIS, 37 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 38 * See the License for the specific language governing permissions and 39 * limitations under the License. 40 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ 41 */ 42 43 /** 44 * Class WBEMProtocol encapsulates a transport/presentation protocol pair. E.g. 45 * "HTTPS/CIM-XML" 46 * 47 * <code>iTransport != null<br />iPresentation != null</code> 48 * @since 2.0.2 49 */ 50 public class WBEMProtocol { 51 private String iTransport; 52 53 private String iPresentation; 54 55 /** 56 * Ctor. 57 * 58 * @param pTransport 59 * The transport protocol (e.g. HTTP, HTTPS, RMI) 60 * @param pPresentation 61 * The presentation protocol (e.g. CIM-XML) 62 */ 63 public WBEMProtocol(String pTransport, String pPresentation) { 64 this.iTransport = pTransport != null ? pTransport.toUpperCase() : ""; 65 this.iPresentation = pPresentation != null ? pPresentation.toUpperCase() : ""; 66 } 67 68 /** 69 * Returns the presentation protocol (e.g. CIM-XML) 70 * 71 * @return The value. 72 */ 73 public String getPresentation() { 74 return this.iPresentation; 75 } 76 77 /** 78 * Sets the presentation protocol 79 * 80 * @param pPresentation 81 * The new value (e.g. CIM-XML) 82 */ 83 public void setPresentation(String pPresentation) { 84 this.iPresentation = pPresentation != null ? pPresentation : ""; 85 } 86 87 /** 88 * Returns transport protocol (e.g. HTTP) 89 * 90 * @return The value. 91 */ 92 public String getTransport() { 93 return this.iTransport; 94 } 95 96 /** 97 * Sets the transport protocol 98 * 99 * @param pTransport 100 * The new value (e.g. HTTP). 101 */ 102 public void setTransport(String pTransport) { 103 this.iTransport = pTransport != null ? pTransport : ""; 104 } 105 106 /* 107 * (non-Javadoc) 108 * 109 * @see java.lang.Object#equals(java.lang.Object) 110 */ 111 @Override 112 public boolean equals(Object pObj) { 113 if (pObj instanceof WBEMProtocol) { 114 WBEMProtocol that = (WBEMProtocol) pObj; 115 return (this.iTransport.equals(that.iTransport)) && (this.iPresentation.equals(that.iPresentation)); 116 } 117 return false; 118 } 119 120 /* 121 * (non-Javadoc) 122 * 123 * @see java.lang.Object#hashCode() 124 */ 125 @Override 126 public int hashCode() { 127 return this.iTransport.hashCode() + this.iPresentation.hashCode(); 128 } 129 130 /* 131 * (non-Javadoc) 132 * 133 * @see java.lang.Object#toString() 134 */ 135 @Override 136 public String toString() { 137 return this.iTransport + "/" + this.iPresentation; 138 } 139 }