public static XmlProviderManager buildXmlProvider() {

    ClassPathResource res = new ClassPathResource("rayo-providers.xml");
    XmlBeanFactory factory = new XmlBeanFactory(res);
    XmlProviderManager manager = (XmlProviderManager) factory.getBean("xmlProviderManager");
    Validator validator = (Validator) factory.getBean("validator");

    RayoClientProvider rayoClientProvider = new RayoClientProvider();
    rayoClientProvider.setNamespaces(new ArrayList<String>());
    rayoClientProvider.getNamespaces().add("urn:xmpp:rayo:1");
    rayoClientProvider.getNamespaces().add("jabber:client");
    rayoClientProvider.setValidator(validator);
    rayoClientProvider.setClasses(new ArrayList<Class<?>>());
    manager.register(rayoClientProvider);

    return manager;
  }
示例#2
0
 public void registerVerbFactory(VerbFactory factory) {
   factoryMap.put(factory.getModelClass(), factory);
   xmlProviderManager.register(factory.getXmlProvider());
 }