mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Improved Javadocs.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1933 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
5e6ebe8c88
commit
7581872f41
1 changed files with 46 additions and 4 deletions
|
@ -97,7 +97,7 @@ import java.net.URL;
|
|||
* used to try to automatically set properties of the IQ instance using the values found
|
||||
* in the IQ packet XML. For example, an XMPP time packet resembles the following:
|
||||
* <pre>
|
||||
* <iq type='get' to='joe@example.com' from='mary@example.com' id='time_1'>
|
||||
* <iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'>
|
||||
* <query xmlns='jabber:iq:time'>
|
||||
* <utc>20020910T17:58:35</utc>
|
||||
* <tz>MDT</tz>
|
||||
|
@ -233,19 +233,61 @@ public class ProviderManager {
|
|||
catch (Exception e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IQ provider registered to the specified XML element name and namespace.
|
||||
* For example, if a provider was registered to the element name "query" and the
|
||||
* namespace "jabber:iq:time", then the following packet would trigger the provider:
|
||||
*
|
||||
* <pre>
|
||||
* <iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'>
|
||||
* <query xmlns='jabber:iq:time'>
|
||||
* <utc>20020910T17:58:35</utc>
|
||||
* <tz>MDT</tz>
|
||||
* <display>Tue Sep 10 12:58:35 2002</display>
|
||||
* </query>
|
||||
* </iq></pre>
|
||||
*
|
||||
* @param elementName the XML element name.
|
||||
* @param namespace the XML namespace.
|
||||
* @return
|
||||
*/
|
||||
public synchronized static Object getIQProvider(String elementName, String namespace) {
|
||||
String key = getProviderKey(elementName, namespace);
|
||||
return iqProviders.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the packet extension provider registered to the specified XML element name
|
||||
* and namespace. For example, if a provider was registered to the element name "x" and the
|
||||
* namespace "jabber:x:event", then the following packet would trigger the provider:
|
||||
*
|
||||
* <pre>
|
||||
* <message to='romeo@montague.net' id='message_1'>
|
||||
* <body>Art thou not Romeo, and a Montague?</body>
|
||||
* <x xmlns='jabber:x:event'>
|
||||
* <composing/>
|
||||
* </x>
|
||||
* </message></pre>
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @return
|
||||
*/
|
||||
public synchronized static Object getExtensionProvider(String elementName, String namespace) {
|
||||
String key = getProviderKey(elementName, namespace);
|
||||
return extensionProviders.get(key);
|
||||
}
|
||||
|
||||
private static String getProviderKey(String elementName, String nameSpace) {
|
||||
/**
|
||||
* Returns a String key for a given element name and namespace.
|
||||
*
|
||||
* @param elementName the element name.
|
||||
* @param namespace the namespace.
|
||||
* @return a unique key for the element name and namespace pair.
|
||||
*/
|
||||
private static String getProviderKey(String elementName, String namespace) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("<").append(elementName).append("/><").append(nameSpace).append("/>");
|
||||
buf.append("<").append(elementName).append("/><").append(namespace).append("/>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
@ -280,4 +322,4 @@ public class ProviderManager {
|
|||
}
|
||||
return parser;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue