Java 类org.apache.camel.builder.xml.Namespaces 实例源码

项目:Camel    文件:XPathWithNamespaceBuilderFilterAndResultTypeTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            // lets define the namespaces we'll need in our filters
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese")
                    .add("xsd", "http://www.w3.org/2001/XMLSchema");

            // now lets create an xpath based Message Filter
            from("direct:start").
                    filter(ns.xpath("/c:person[@name='James']", String.class)).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
项目:Camel    文件:XPathWithNamespaceBuilderFilterTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            // lets define the namespaces we'll need in our filters
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese")
                    .add("xsd", "http://www.w3.org/2001/XMLSchema");

            // now lets create an xpath based Message Filter
            from("direct:start").
                    filter(ns.xpath("/c:person[@name='James']")).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
项目:Camel    文件:SplitGroupMultiXmlTokenTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/pair")
                    // split the order child tags, and inherit namespaces from the orders root tag
                    .split().xtokenize("//order", 'i', ns, 2)
                    .to("log:split")
                    .to("mock:split");
            // END SNIPPET: e1
        }
    };
}
项目:Camel    文件:SplitGroupWrappedMultiXmlTokenTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/pair")
                    // split the order child tags, and inherit namespaces from the orders root tag
                    .split().xtokenize("//order", 'w', ns, 2)
                    .to("log:split")
                    .to("mock:split");
            // END SNIPPET: e1
        }
    };
}
项目:Camel    文件:XMLTokenSplitTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("", "http:acme.com");
        @Override
        public void configure() throws Exception {
            // START SNIPPET: e1
            from("file:target/xtokenizer")
                // split the order child tags, and inherit namespaces from the orders root tag
                .split().xtokenize("//orders/order", ns)
                    .to("mock:split");
            // END SNIPPET: e1

            from("file:target/xtokenizer2")
                // split the order child tags, and inherit namespaces from the orders root tag
                .split(body().xtokenize("//orders/order", ns))
                    .to("mock:split");
        }
    };
}
项目:Camel    文件:SplitterWithXqureyTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // split the message with namespaces defined 
            Namespaces namespaces = new Namespaces("one", "http://camel.apache.org/schema/one");                
            from("direct:endpoint").split().xpath("//one:other", namespaces).to("mock:result");

            from("direct:toString").split().xpath("//one:other", namespaces)
                .process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        Element element = (Element) exchange.getIn().getBody();
                        String message = CxfUtils.elementToString(element);
                        exchange.getOut().setBody(message);
                    }
                })
                .to("mock:result");
        }
    };
}
项目:cleverbus    文件:AsyncHelloRoute.java   
/**
 * Route for asynchronous <strong>asyncHello</strong> input operation.
 * <p/>
 * Prerequisite: none
 * <p/>
 * Output: {@link AsyncHelloResponse}
 */
private void createRouteForAsyncHelloRouteIn() {
    Namespaces ns = new Namespaces("h", SyncHelloRoute.HELLO_SERVICE_NS);

    // note: mandatory parameters are set already in XSD, this validation is extra
    XPathValidator validator = new XPathValidator("/h:asyncHelloRequest", ns, "h:name");

    // note: only shows using but without any influence in this case
    Expression nameExpr = xpath("/h:asyncHelloRequest/h:name").namespaces(ns).stringResult();

    AsynchRouteBuilder.newInstance(ServiceEnum.HELLO, OPERATION_NAME,
            getInWsUri(new QName(SyncHelloRoute.HELLO_SERVICE_NS, "asyncHelloRequest")),
            new AsynchResponseProcessor() {
                @Override
                protected Object setCallbackResponse(CallbackResponse callbackResponse) {
                    AsyncHelloResponse res = new AsyncHelloResponse();
                    res.setConfirmAsyncHello(callbackResponse);
                    return res;
                }
            }, jaxb(AsyncHelloResponse.class))

            .withValidator(validator)
            .withObjectIdExpr(nameExpr)
            .build(this);
}
项目:wildfly-camel    文件:XSLTIntegrationTest.java   
@Test
public void testQueryTransform() throws Exception {

    CamelContext camelctx = new DefaultCamelContext();
    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Namespaces ns = new Namespaces("ns", "http://org/wildfly/test/jaxb/model/Customer");
            from("direct:start").transform().xquery("/ns:customer/ns:firstName", String.class, ns)
            .to("mock:result");
        }
    });

    camelctx.start();
    try {
        //System.out.println(readCustomerXml());
        ProducerTemplate producer = camelctx.createProducerTemplate();
        String customer = producer.requestBody("direct:start", readCustomerXml("/customer.xml"), String.class);
        Assert.assertEquals("John", customer);
    } finally {
        camelctx.stop();
    }
}
项目:Camel    文件:ExpressionClauseSupport.java   
/**
 * Evaluates an XML token expression on the message body with XML content
 * 
 * @param path the xpath like path notation specifying the child nodes to tokenize
 * @param mode one of 'i', 'w', or 'u' to inject the namespaces to the token, to
 *        wrap the token with its ancestor contet, or to unwrap to its element child
 * @param namespaces the namespace map to the namespace bindings 
 * @param group to group by the given number
 * @return the builder to continue processing the DSL
 */
public T xtokenize(String path, char mode, Namespaces namespaces, int group) {
    XMLTokenizerExpression expression = new XMLTokenizerExpression(path);
    expression.setMode(Character.toString(mode));
    expression.setNamespaces(namespaces.getNamespaces());

    if (group > 0) {
        expression.setGroup(group);
    }
    setExpressionType(expression);
    return result;
}
项目:Camel    文件:SetHeaderIssueTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            Namespaces ns = new Namespaces("foo", "urn:cheese");

            from("direct:start").
                    unmarshal().string().
                    setHeader("foo", ns.xpath("/foo:person[@name='James']")).
                    filter(ns.xpath("/foo:person[@name='James']")).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
项目:Camel    文件:XPathWithNamespacesFilterTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese");

            from("direct:start").filter().
                    xpath("/c:person[@name='James']", ns).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
项目:Camel    文件:SplitterWithXqureyTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // split the message with namespaces defined 
            Namespaces namespaces = new Namespaces("one", "http://camel.apache.org/schema/one");                
            from("direct:endpoint").split().xpath("//one:other", namespaces).to("mock:result");                
        }
    };
}
项目:Camel    文件:XMLTokenizeLanguageStreamingFileTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("file:target/xmltokenize")
                .split().xtokenize("//C:child", ns).streaming()
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:XMLTokenizeLanguageGroupingTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", 'i', ns, 2)
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:XMLTokenizeWrapLanguageTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", 'w', ns)
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:XMLTokenizeWrapLanguageGroupingTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", 'w', ns, 2)
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:XMLTokenizeLanguageTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", ns)
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:XMLTokenizeLanguageStreamingTest.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        Namespaces ns = new Namespaces("C", "urn:c");
        public void configure() {
            from("direct:start")
                .split().xtokenize("//C:child", ns).streaming()
                    .to("mock:result")
                .end();
        }
    };
}
项目:Camel    文件:RssToHttpIssueTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            Namespaces ns = new Namespaces("atom", "http://www.w3.org/2005/Atom");
            from("rss:http://www.plosone.org/article/feed")
                    .marshal().rss()
                    .setHeader(Exchange.HTTP_URI).xpath("//atom:entry/atom:link[@type=\"application/pdf\"]/@href", ns)
                    .to("http://dummy")
                    .to("mock:end");
        }
    };
}
项目:Camel    文件:XQueryHeaderNameResultTypeAndNamespaceTest.java   
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        public void configure() throws Exception {
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese");

            from("direct:in").choice()
                .when().xquery("/c:number = 55", Integer.class, ns, "cheeseDetails")
                    .to("mock:55")
                .otherwise()
                    .to("mock:other")
                .end();
        }
    };
}
项目:Camel    文件:XQueryWithNamespacesFilterTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {
            // START SNIPPET: example
            Namespaces ns = new Namespaces("c", "http://acme.com/cheese");

            from("direct:start").
                    filter().xquery("/c:person[@name='James']", ns).
                    to("mock:result");
            // END SNIPPET: example
        }
    };
}
项目:fcrepo-camel-toolbox    文件:FixityRouter.java   
/**
 * Configure the message route workflow.
 */
public void configure() throws Exception {

    final Namespaces ns = new Namespaces("rdf", RDF.uri);
    ns.add("premis", "http://www.loc.gov/premis/rdf/v1#");

    /**
     * A generic error handler (specific to this RouteBuilder)
     */
    onException(Exception.class)
        .maximumRedeliveries("{{error.maxRedeliveries}}")
        .log("Index Routing Error: ${routeId}");

    /**
     * Handle fixity events
     */
    from("{{fixity.stream}}")
        .routeId("FcrepoFixity")
        .to("fcrepo:{{fcrepo.baseUrl}}?preferInclude=ServerManged&accept=application/rdf+xml")
        .filter().xpath(
                "/rdf:RDF/rdf:Description/rdf:type" +
                "[@rdf:resource='" + REPOSITORY + "Binary']", ns)
        .log(LoggingLevel.INFO, LOGGER,
                "Checking Fixity for ${headers[CamelFcrepoUri]}")
        .delay(simple("{{fixity.delay}}"))
        .to("fcrepo:{{fcrepo.baseUrl}}?fixity=true&accept=application/rdf+xml")
        .choice()
            .when().xpath(
                    "/rdf:RDF/rdf:Description/premis:hasEventOutcome" +
                    "[text()='SUCCESS']", ns)
                .to("{{fixity.success}}")
            .otherwise()
                .log(LoggingLevel.WARN, LOGGER,
                    "Fixity error on ${headers[CamelFcrepoUri]}")
                .to("{{fixity.failure}}");
}
项目:fcrepo-camel-toolbox    文件:RouteIT.java   
@Test
public void testFixityOnBinary() throws Exception {
    final String webPort = System.getProperty("fcrepo.dynamic.test.port", "8080");
    final String jmsPort = System.getProperty("fcrepo.dynamic.jms.port", "61616");
    final String path = fullPath.replaceFirst("http://localhost:[0-9]+/fcrepo/rest", "");
    final String fcrepoEndpoint = "mock:fcrepo:http://localhost:8080/fcrepo/rest";
    final Namespaces ns = new Namespaces("rdf", RDF.uri);
    ns.add("fedora", REPOSITORY);
    ns.add("premis", "http://www.loc.gov/premis/rdf/v1#");

    context.getRouteDefinition("FcrepoFixity").adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            mockEndpoints("*");
        }
    });
    context.start();

    getMockEndpoint(fcrepoEndpoint).expectedMessageCount(2);
    getMockEndpoint("mock:success").expectedMessageCount(1);

    template.sendBodyAndHeader("direct:start", "", FCREPO_URI,
            "http://localhost:" + webPort + "/fcrepo/rest" + path);

    assertMockEndpointsSatisfied();

    final String body = getMockEndpoint("mock:success").assertExchangeReceived(0).getIn().getBody(String.class);
    assertTrue(body.contains(
            "<premis:hasSize rdf:datatype=\"http://www.w3.org/2001/XMLSchema#long\">74</premis:hasSize>"));
    assertTrue(body.contains(
            "<premis:hasMessageDigest rdf:resource=\"urn:sha1:" + digest + "\"/>"));
}
项目:camel-c24io    文件:XPathTest.java   
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        public void configure() {

            Namespaces ns = new Namespaces("foo", "http://www.c24.biz/io/GettingStarted/Transaction");

            from("file:src/test/data?noop=true").
                    unmarshal(c24io(Transactions.class)).
                    filter(ns.xquery("//foo:Currency = 'GBP'")).
                    to("mock:result");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoContainerHeadIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {

            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:create")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:head")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='http://fedora.info/definitions/v4/repository#Container']", ns)
                .to("mock:filter")
                .setHeader(Exchange.HTTP_METHOD, constant("HEAD"))
                .to(fcrepo_uri)
                .to("mock:container");

            from("direct:delete")
                .setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
                .to(fcrepo_uri)
                .to("mock:deleted")
                .setHeader(Exchange.HTTP_METHOD, constant("GET"))
                .to(fcrepo_uri + "?throwExceptionOnFailure=false")
                .to("mock:verifyGone");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoPathIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {

            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:setup")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:check")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Resource']", ns)
                .to("mock:result");

            from("direct:checkPath")
                .to(fcrepo_uri + "/test/a/b/c/d")
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Resource']", ns)
                .to("mock:result");

            from("direct:teardown")
                .to(fcrepo_uri)
                .to("mock:deleted");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoBinaryHeadIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {

            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:create")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:head")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Binary']", ns)
                .to("mock:filter")
                .setHeader(Exchange.HTTP_METHOD, constant("HEAD"))
                .to(fcrepo_uri + "?metadata=false")
                .to("mock:binary");

             from("direct:delete")
                .setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
                .to(fcrepo_uri)
                .to("mock:deleted")
                .setHeader(Exchange.HTTP_METHOD, constant("GET"))
                .to(fcrepo_uri + "?throwExceptionOnFailure=false")
                .to("mock:verify");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoPutIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {
            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:setup")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:setup2")
                .to(fcrepo_uri + "?contentType=text/turtle")
                .to("mock:created");

            from("direct:start")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Resource']", ns)
                .to("mock:result");

            from("direct:teardown")
                .to(fcrepo_uri)
                .to("mock:deleted");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoComponentConfigurationIT.java   
@Override
protected RouteBuilder createRouteBuilder() {

    final FcrepoComponent fcrepo = (FcrepoComponent)context.getComponent("fcrepo");
    fcrepo.setBaseUrl(getFcrepoBaseUrl());

    return new RouteBuilder() {
        @Override
        public void configure() {

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:create")
                .to("fcrepo:foo")
                .to("mock:created");

            // use an explicit scheme with the fcrepo: endpoint
            from("direct:get")
                .to("fcrepo:bar")
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Container']", ns)
                .to("mock:filter")
                .to("fcrepo:baz")
                .to("mock:container");

            from("direct:delete")
                .setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
                .to("fcrepo:foo")
                .to("mock:deleted")
                .setHeader(Exchange.HTTP_METHOD, constant("GET"))
                .to("fcrepo:bar?throwExceptionOnFailure=false")
                .to("mock:verifyGone");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoDeleteIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {

            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:create")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:get")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Container']", ns)
                .to("mock:filter")
                .to(fcrepo_uri)
                .to("mock:container");

            from("direct:delete")
                .setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
                .to(fcrepo_uri)
                .to("mock:deleted")
                .setHeader(Exchange.HTTP_METHOD, constant("GET"))
                .to(fcrepo_uri + "?throwExceptionOnFailure=false")
                .to("mock:verifyGone");

            from("direct:getPostDelete")
                .to(fcrepo_uri + "?throwExceptionOnFailure=false")
                .to("mock:verifyGone");

        }
    };
}
项目:fcrepo-camel    文件:FcrepoContainerGetIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {

            final String fcrepo_uri = getFcrepoEndpointUriWithScheme();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            from("direct:create")
                .to(fcrepo_uri)
                .to("mock:created");

            // use an explicit scheme with the fcrepo: endpoint
            from("direct:get")
                .to(fcrepo_uri)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Container']", ns)
                .to("mock:filter")
                .to(fcrepo_uri)
                .to("mock:container");

            from("direct:delete")
                .setHeader(HTTP_METHOD, constant("DELETE"))
                .to(fcrepo_uri)
                .to("mock:deleted")
                .setHeader(HTTP_METHOD, constant("GET"))
                .to(fcrepo_uri + "?throwExceptionOnFailure=false")
                .to("mock:verifyGone");
        }
    };
}
项目:fcrepo-camel    文件:FcrepoPostIT.java   
@Override
protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {
            final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUri();

            final Namespaces ns = new Namespaces("rdf", RDF.uri);

            final XPathBuilder titleXpath = new XPathBuilder("/rdf:RDF/rdf:Description/dc:title/text()");
            titleXpath.namespaces(ns);
            titleXpath.namespace("dc", "http://purl.org/dc/elements/1.1/");

            from("direct:setup")
                .to(fcrepo_uri)
                .to("mock:created");

            from("direct:start")
                .to(fcrepo_uri)
                .convertBodyTo(org.w3c.dom.Document.class)
                .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Resource']", ns)
                .split(titleXpath)
                .to("mock:result");

            from("direct:teardown")
                .to(fcrepo_uri)
                .to("mock:deleted");
        }
    };
}
项目:cleverbus    文件:XPathValidator.java   
/**
 * Creates new XPath validator.
 *
 * @param parentElm the parent element (if any)
 * @param ns the namespace(s)
 * @param elements the element names;
 */
public XPathValidator(@Nullable String parentElm, Namespaces ns, String... elements) {
    Assert.notNull(ns, "the ns must not be null");
    Assert.notEmpty(elements, "the elements must not be empty");

    this.ns = ns;
    this.parentElm = parentElm;
    this.elements = elements;
}
项目:cleverbus    文件:XPathValidator.java   
/**
 * Creates new XPath validator with empty parent element.
 *
 * @param ns the namespace(s)
 * @param elements the elements
 */
public XPathValidator(Namespaces ns, String... elements) {
    Assert.notNull(ns, "the ns must not be null");
    Assert.notEmpty(elements, "the elements must not be empty");

    this.ns = ns;
    this.elements = elements;
}
项目:camel-cookbook-examples    文件:SplitXmlNamespacesRoute.java   
@Override
public void configure() throws Exception {
    Namespaces ns = new Namespaces("c", "http://camelcookbook.org/schema/books")
        .add("se", "http://camelcookbook.org/schema/somethingElse");

    from("direct:in")
        .split(ns.xpath("/c:books/c:book[@category='Tech']/c:authors/c:author/text()"))
            .to("mock:out")
        .end();
}
项目:camel-cookbook-examples    文件:SecurityAsymNamespacesSpringTest.java   
@Test
public void testXmlEncryptionDecryption() throws Exception {
    final Namespaces namespaces = new Namespaces("c", "http://camelcookbook.org/schema/booksignings");
    final String cityExistsXPath = "/c:booksignings/c:store/c:address/c:city";

    context.getRouteDefinition("encrypt")
        .adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("direct:decrypt")
                    .when(namespaces.xpath(cityExistsXPath))
                        .to("mock:incorrectlyEncrypted");
            }
        });
    context.getRouteDefinition("decrypt")
        .adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:out")
                    .when(namespaces.xpath(cityExistsXPath))
                        .to("mock:correctlyDecrypted");
            }
        });
    context.start();

    MockEndpoint mockIncorrectlyEncrypted = getMockEndpoint("mock:incorrectlyEncrypted");
    mockIncorrectlyEncrypted.setExpectedMessageCount(0);
    MockEndpoint mockCorrectlyDecrypted = getMockEndpoint("mock:correctlyDecrypted");
    mockCorrectlyDecrypted.setExpectedMessageCount(1);
    MockEndpoint mockOut = getMockEndpoint("mock:out");
    mockOut.setExpectedMessageCount(1);

    final InputStream resource = getClass().getClassLoader().getResourceAsStream("booklocations-ns.xml");
    final String request = context().getTypeConverter().convertTo(String.class, resource);

    template.sendBody("direct:encrypt", request);
    assertMockEndpointsSatisfied();
}
项目:camel-cookbook-examples    文件:SecurityAsymNamespacesTest.java   
@Test
public void testXmlEncryptionDecryption() throws Exception {
    final Namespaces namespaces = new Namespaces("c", "http://camelcookbook.org/schema/booksignings");
    final String cityExistsXPath = "/c:booksignings/c:store/c:address/c:city";

    context.getRouteDefinition("encrypt")
        .adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("direct:decrypt")
                    .when(namespaces.xpath(cityExistsXPath))
                        .to("mock:incorrectlyEncrypted");
            }
        });
    context.getRouteDefinition("decrypt")
        .adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("mock:out")
                    .when(namespaces.xpath(cityExistsXPath))
                        .to("mock:correctlyDecrypted");
            }
        });
    context.start();

    MockEndpoint mockIncorrectlyEncrypted = getMockEndpoint("mock:incorrectlyEncrypted");
    mockIncorrectlyEncrypted.setExpectedMessageCount(0);
    MockEndpoint mockCorrectlyDecrypted = getMockEndpoint("mock:correctlyDecrypted");
    mockCorrectlyDecrypted.setExpectedMessageCount(1);
    MockEndpoint mockOut = getMockEndpoint("mock:out");
    mockOut.setExpectedMessageCount(1);

    final InputStream resource = getClass().getClassLoader().getResourceAsStream("booklocations-ns.xml");
    final String request = context().getTypeConverter().convertTo(String.class, resource);

    template.sendBody("direct:encrypt", request);
    assertMockEndpointsSatisfied();
}
项目:jentrata    文件:EbmsSignalMessageHandlerRouteBuilder.java   
@Override
public void configure() throws Exception {

    final Namespaces ns = new Namespaces("S12", "http://www.w3.org/2003/05/soap-envelope")
            .add("eb3", "http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/");

    from(inboundEbmsSignalsQueue)
        .choice()
            .when(header(EbmsConstants.CPA_ID).isEqualTo(EbmsConstants.CPA_ID_UNKNOWN))
                .log(LoggingLevel.WARN,"Received SignalMessage from unknown partner - msgId:${headers.JentrataMessageID} - type:${headers.JentrataMessageType}")
            .when(header(EbmsConstants.MESSAGE_TYPE).isEqualTo(MessageType.SIGNAL_MESSAGE))
                .log(LoggingLevel.INFO,"Received Signal Message for - cpaId:${headers.JentrataCPAId} - msgId:${headers.JentrataMessageID} - refMsgId:${headers.JentrataRefMessageID}")
                .setHeader("JentrataOriginalMessageID",header(EbmsConstants.MESSAGE_ID))
                .setHeader(EbmsConstants.MESSAGE_ID,header(EbmsConstants.REF_TO_MESSAGE_ID))
                .setHeader(EbmsConstants.MESSAGE_DIRECTION,constant(EbmsConstants.MESSAGE_DIRECTION_OUTBOUND))
                .setHeader(EbmsConstants.MESSAGE_STATUS, constant(MessageStatusType.DONE))
                .to(messageUpdateEndpoint)
            .when(header(EbmsConstants.MESSAGE_TYPE).isEqualTo(MessageType.SIGNAL_MESSAGE_WITH_USER_MESSAGE))
                .log(LoggingLevel.INFO,"Received Signal Message for - cpaId:${headers.JentrataCPAId} - msgId:${headers.JentrataMessageID} - refMsgId:${headers.JentrataRefMessageID}")
                .setHeader("JentrataOriginalMessageID",header(EbmsConstants.MESSAGE_ID))
                .setHeader(EbmsConstants.MESSAGE_ID,header(EbmsConstants.REF_TO_MESSAGE_ID))
                .setHeader(EbmsConstants.MESSAGE_DIRECTION,constant(EbmsConstants.MESSAGE_DIRECTION_OUTBOUND))
                .setHeader(EbmsConstants.MESSAGE_STATUS, constant(MessageStatusType.DONE))
                .to(messageUpdateEndpoint)
            .when(header(EbmsConstants.MESSAGE_TYPE).isEqualTo(MessageType.SIGNAL_MESSAGE_ERROR))
                .setHeader("JentrataOriginalMessageID", header(EbmsConstants.MESSAGE_ID))
                .setHeader(EbmsConstants.REF_TO_MESSAGE_ID, ns.xpath("//eb3:Error/@refToMessageInError",String.class))
                .log(LoggingLevel.INFO, "Received Error Signal Message for - cpaId:${headers.JentrataCPAId} - msgId:${headers.JentrataMessageID} - refMsgId:${headers.JentrataRefMessageID}")
                .setHeader(EbmsConstants.MESSAGE_ID, header(EbmsConstants.REF_TO_MESSAGE_ID))
                .setHeader(EbmsConstants.MESSAGE_DIRECTION,constant(EbmsConstants.MESSAGE_DIRECTION_OUTBOUND))
                .setHeader(EbmsConstants.MESSAGE_STATUS,constant(MessageStatusType.ERROR))
                .setHeader(EbmsConstants.MESSAGE_STATUS_DESCRIPTION,xpath("//*[local-name()='Description'][1]/text()").stringResult())
                .to(messageUpdateEndpoint)
            .otherwise()
                .log(LoggingLevel.WARN,"Received unknown message type - msgId:${headers.JentrataMessageID} - type:${headers.JentrataMessageType}")
        .end()
    .routeId("_jentrataSignalMessageHandler");
}
项目:Camel    文件:ValueBuilder.java   
public ValueBuilder xtokenize(String path, Namespaces namespaces) {
    return xtokenize(path, 'i', namespaces);
}
项目:Camel    文件:ValueBuilder.java   
public ValueBuilder xtokenize(String path, char mode, Namespaces namespaces) {
    Expression newExp = ExpressionBuilder.tokenizeXMLAwareExpression(path, mode);
    ((NamespaceAware)newExp).setNamespaces(namespaces.getNamespaces());
    return onNewValueBuilder(newExp);
}