Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.NamespaceHandler


        return super.getProperty(name);
    }

    protected DynamicElementReader createDynamicElementReader(String namespace, final boolean decorator) {
        NamespaceHandler handler = namespaceHandlers.get(namespace);
        ParserContext parserContext = new ParserContext(readerContext, new BeanDefinitionParserDelegate(readerContext));
        final DynamicElementReader dynamicElementReader = new DynamicElementReader(namespace, namespaces, handler, parserContext) {
            @Override
            protected void afterInvocation() {
                if (!decorator) {
View Full Code Here


public class DefaultNamespaceHandlerResolverTests {

  @Test
  public void testResolvedMappedHandler() {
    DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
    NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
    assertNotNull("Handler should not be null.", handler);
    assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
  }
View Full Code Here

  }

  @Test
  public void testResolvedMappedHandlerWithNoArgCtor() {
    DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
    NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
    assertNotNull("Handler should not be null.", handler);
    assertEquals("Incorrect handler loaded", UtilNamespaceHandler.class, handler.getClass());
  }
View Full Code Here

        String namespace = entry.getKey();
        String uri = entry.getValue();
        if (uri == null) {
          throw new IllegalArgumentException("Namespace definition must supply a non-null URI");
        }
        NamespaceHandler namespaceHandler = this.xmlBeanDefinitionReader.getNamespaceHandlerResolver().resolve(uri);
        if (namespaceHandler == null) {
          throw new BeanDefinitionParsingException(new Problem("No namespace handler found for URI: " + uri,
              new Location(new DescriptiveResource(("Groovy")))));
        }
        this.namespaces.put(namespace, uri);
View Full Code Here

    @Test
    public void test6_resolve() {
        createConfigurationPoints("TEST-INF/test6/cps");

        NamespaceHandler nh = resolver.resolve("http://www.alibaba.com/test6/cp1");

        assertSame(cps.getConfigurationPointByName("cp1"), nh);
    }
View Full Code Here

    @Test
    public void test6_resolveDefault() {
        createConfigurationPoints("TEST-INF/test6/cps");

        NamespaceHandler nh = resolver.resolve("http://www.springframework.org/schema/context");

        assertThat(nh, instanceOf(ContextNamespaceHandler.class));
    }
View Full Code Here

    @Test
    public void test6_resolve() {
        createConfigurationPoints("TEST-INF/test6/cps");

        NamespaceHandler nh = resolver.resolve("http://www.alibaba.com/test6/cp1");

        assertSame(cps.getConfigurationPointByName("cp1"), nh);
    }
View Full Code Here

    @Test
    public void test6_resolveDefault() {
        createConfigurationPoints("TEST-INF/test6/cps");

        NamespaceHandler nh = resolver.resolve("http://www.springframework.org/schema/context");

        assertThat(nh, instanceOf(ContextNamespaceHandler.class));
    }
View Full Code Here

  }

  @Override
  public NamespaceHandler resolve(final String namespaceUri) {
    for (final NamespaceHandlerResolver resolver : resolvers) {
      final NamespaceHandler handler = resolver.resolve(namespaceUri);
      if (handler != null) {
        return handler;
      }
    }
    return null;
View Full Code Here

    for (Iterator iterator = resolvers.entrySet().iterator(); iterator.hasNext();) {
      Map.Entry entry = (Map.Entry) iterator.next();
      NamespaceHandlerResolver handlerResolver = (NamespaceHandlerResolver) entry.getKey();
      if (trace)
        log.trace("Trying to resolve namespace [" + namespaceUri + "] through resolver " + entry.getValue());
      NamespaceHandler handler = handlerResolver.resolve(namespaceUri);

      String resolvedMsg = (handler != null ? "" : "not ");
      if (trace)
        log.trace("Namespace [" + namespaceUri + "] was " + resolvedMsg + "resolved through handler resolver "
            + entry.getValue());
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.NamespaceHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.