1 /*
2  * Copyright (C) 2004-2008 Jive Software. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package org.jivesoftware.openfire;
18 
19 /**
20  * <p>A simple meta-data class that stores several related tools for
21  * generic IQ protocol handling.</p>
22  * <p>To handle an IQ packet, the server needs to know:</p>
23  * <ul>
24  * <li>The fully qualified name of the iq sub-element. IQ packets are
25  * identified using this information when matching to a handler.</li>
26  * <li>The IQHandler that will handle this packet if addressed to the
27  * server (no 'to' attribute).</li>
28  * <li>The IQ parser to use to generate the correct IQ packet.</li>
29  * </ul>
30  * <p>We provide this information by having all IQHandlers report
31  * their info. Interested parties can watch for IQHandlers in the service
32  * lookup and build appropriate data structures on the current state of
33  * IQ handlers in the system.</p>
34  *
35  * @author Iain Shigeoka
36  */
37 public class IQHandlerInfo {
38 
39     private String name;
40     private String namespace;
41 
42     /**
43      * <p>Construct an info object.</p>
44      *
45      * @param name      The name of the root iq element
46      * @param namespace The namespace of the root iq element
47      */
IQHandlerInfo(String name, String namespace)48     public IQHandlerInfo(String name, String namespace) {
49         this.name = name;
50         this.namespace = namespace;
51     }
52 
53     /**
54      * <p>Obtain the name of the root iq element for this packet type.</p>
55      *
56      * @return The name of the root iq element
57      */
getName()58     public String getName() {
59         return name;
60     }
61 
62     /**
63      * <p>Obtain the namespace of the root iq element for this packet type.</p>
64      *
65      * @return the namespace of the root iq element.
66      */
getNamespace()67     public String getNamespace() {
68         return namespace;
69     }
70 }
71