View Javadoc
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 : Endre Bak, IBM, ebak@de.ibm.com
12   * 
13   * Change History
14   * Flag       Date        Prog         Description
15   *------------------------------------------------------------------------------- 
16   * 1804402    2007-09-28  ebak         IPv6 ready SLP
17   * 1892103    2008-02-12  ebak         SLP improvements
18   * 1949918    2008-04-08  raman_arora  Malformed service URL crashes SLP discovery
19   * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
20   * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
21   * 2531371    2009-02-10  raman_arora  Upgrade client to JDK 1.5 (Phase 2) 
22   */
23  
24  package org.metricshub.wbem.sblim.slp.internal.msg;
25  
26  /*-
27   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
28   * WBEM Java Client
29   * ჻჻჻჻჻჻
30   * Copyright 2023 - 2025 MetricsHub
31   * ჻჻჻჻჻჻
32   * Licensed under the Apache License, Version 2.0 (the "License");
33   * you may not use this file except in compliance with the License.
34   * You may obtain a copy of the License at
35   *
36   *      http://www.apache.org/licenses/LICENSE-2.0
37   *
38   * Unless required by applicable law or agreed to in writing, software
39   * distributed under the License is distributed on an "AS IS" BASIS,
40   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41   * See the License for the specific language governing permissions and
42   * limitations under the License.
43   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
44   */
45  
46  import java.io.IOException;
47  import java.util.Iterator;
48  import org.metricshub.wbem.sblim.slp.ServiceLocationException;
49  
50  /**
51   * ServiceAcknowledgment message
52   *
53   */
54  public class ServiceAcknowledgment extends ReplyMessage {
55  
56  	/**
57  	 * parse
58  	 *
59  	 * @param pHdr
60  	 * @param pInStr
61  	 * @return SLPMessage
62  	 * @throws ServiceLocationException
63  	 * @throws IOException
64  	 */
65  	public static SLPMessage parse(MsgHeader pHdr, SLPInputStream pInStr) throws ServiceLocationException, IOException {
66  		return new ServiceAcknowledgment(pHdr, pInStr.read16());
67  	}
68  
69  	/**
70  	 * Ctor.
71  	 *
72  	 * @param pErrorCode
73  	 */
74  	public ServiceAcknowledgment(int pErrorCode) {
75  		super(SRV_ACK, pErrorCode);
76  	}
77  
78  	/**
79  	 * Ctor.
80  	 *
81  	 * @param pLangTag
82  	 * @param pErrorCode
83  	 */
84  	public ServiceAcknowledgment(String pLangTag, int pErrorCode) {
85  		super(SRV_ACK, pLangTag, pErrorCode);
86  	}
87  
88  	/**
89  	 * Ctor.
90  	 *
91  	 * @param pHeader
92  	 * @param pErrorCode
93  	 */
94  	public ServiceAcknowledgment(MsgHeader pHeader, int pErrorCode) {
95  		super(pHeader, pErrorCode);
96  	}
97  
98  	@Override
99  	public Iterator<?> getResultIterator() {
100 		// this message doesn't have iterable results
101 		return null;
102 	}
103 
104 	/**
105 	 * @param pOption
106 	 */
107 	@Override
108 	protected boolean serializeBody(SLPOutputStream pOutStr, SerializeOption pOption) {
109 		return pOutStr.write16(getErrorCode());
110 	}
111 
112 	@Override
113 	public Iterator<Exception> getExceptionIterator() {
114 		// this message doesn't have exception table
115 		return null;
116 	}
117 }