1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Minor changes.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1995 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-08-01 21:14:51 +00:00 committed by mtucker
parent 0371343141
commit 5a84b12904

View file

@ -261,22 +261,29 @@ public class ProviderManager {
* @param namespace the XML namespace. * @param namespace the XML namespace.
* @return the IQ provider. * @return the IQ provider.
*/ */
public synchronized static Object getIQProvider(String elementName, String namespace) { public static Object getIQProvider(String elementName, String namespace) {
String key = getProviderKey(elementName, namespace); String key = getProviderKey(elementName, namespace);
return iqProviders.get(key); return iqProviders.get(key);
} }
/** /**
* Adds an IQ provider with the specified element name and name space. The provider * Adds an IQ provider (must be an instance of IQProvider or Class object that is an IQ)
* will override any providers loaded through the classpath. * with the specified element name and name space. The provider will override any providers
* loaded through the classpath.
* *
* @param elementName the XML element name. * @param elementName the XML element name.
* @param namespace the XML namespace. * @param namespace the XML namespace.
* @param provider the IQ provider. * @param provider the IQ provider.
*/ */
public synchronized static void addIQProvider(String elementName, String namespace, public static void addIQProvider(String elementName, String namespace,
IQProvider provider) Object provider)
{ {
if (!(provider instanceof IQProvider || (provider instanceof Class &&
IQ.class.isAssignableFrom((Class)provider))))
{
throw new IllegalArgumentException("Provider must be an IQProvider " +
"or a Class instance.");
}
String key = getProviderKey(elementName, namespace); String key = getProviderKey(elementName, namespace);
iqProviders.put(key, provider); iqProviders.put(key, provider);
} }
@ -300,7 +307,7 @@ public class ProviderManager {
* @param namespace * @param namespace
* @return the extenion provider. * @return the extenion provider.
*/ */
public synchronized static Object getExtensionProvider(String elementName, String namespace) { public static Object getExtensionProvider(String elementName, String namespace) {
String key = getProviderKey(elementName, namespace); String key = getProviderKey(elementName, namespace);
return extensionProviders.get(key); return extensionProviders.get(key);
} }
@ -314,7 +321,7 @@ public class ProviderManager {
* @param namespace the XML namespace. * @param namespace the XML namespace.
* @param provider the extension provider. * @param provider the extension provider.
*/ */
public synchronized static void addExtensionProvider(String elementName, String namespace, public static void addExtensionProvider(String elementName, String namespace,
Object provider) Object provider)
{ {
if (!(provider instanceof PacketExtensionProvider || provider instanceof Class)) { if (!(provider instanceof PacketExtensionProvider || provider instanceof Class)) {