本文整理汇总了Java中org.apache.camel.builder.xml.Namespaces.add方法的典型用法代码示例。如果您正苦于以下问题:Java Namespaces.add方法的具体用法?Java Namespaces.add怎么用?Java Namespaces.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.builder.xml.Namespaces
的用法示例。
在下文中一共展示了Namespaces.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
/**
* 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}}");
}
示例2: testFixityOnBinary
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
@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 + "\"/>"));
}
示例3: createRouteBuilder
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
@Override
public void configure() {
final String fcrepo_uri = FcrepoTestUtils.getFcrepoEndpointUriWithScheme();
final Namespaces ns = new Namespaces("rdf", RDF.uri);
ns.add("ldp", "http://www.w3.org/ns/ldp#");
final XPathBuilder ldpChildren = new XPathBuilder("/rdf:RDF/rdf:Description/ldp:contains");
ldpChildren.namespaces(ns);
getContext().getStreamCachingStrategy().setSpoolThreshold(1024);
getContext().getStreamCachingStrategy().setBufferSize(128);
getContext().setStreamCaching(true);
from("direct:create")
.to(fcrepo_uri)
.to("mock:created");
from("direct:get")
.streamCaching()
.to(fcrepo_uri)
.convertBodyTo(StreamSource.class)
.split(ldpChildren).streaming()
.transform()
.xpath("/ldp:contains/@rdf:resource", String.class, ns)
.to("mock:child");
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");
}
};
}
示例4: createRouteBuilder
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
@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);
ns.add("fedora", REPOSITORY);
ns.add("ldp", LDP);
from("direct:create")
.to(fcrepo_uri)
.to("mock:created");
from("direct:preferHeadersCheckContainment")
.to(fcrepo_uri)
.filter().xpath(
"/rdf:RDF/rdf:Description/ldp:contains", ns)
.to("mock:filter");
from("direct:preferHeadersCheckServerManaged")
.to(fcrepo_uri)
.filter().xpath(
"/rdf:RDF/rdf:Description/fedora:created", ns)
.to("mock:filter");
from("direct:includeServerManaged")
.to(fcrepo_uri + "?preferInclude=ServerManaged")
.filter().xpath(
"/rdf:RDF/rdf:Description/fedora:created", ns)
.to("mock:filter")
.to(fcrepo_uri)
.to("mock:container");
from("direct:includeContainmentOmitManaged")
.to(fcrepo_uri + "?preferOmit=ServerManaged&preferInclude=PreferContainment")
.filter().xpath(
"/rdf:RDF/rdf:Description/ldp:contains", ns)
.to("mock:filter");
from("direct:omitServerManaged")
.to(fcrepo_uri + "?preferOmit=ServerManaged")
.filter().xpath(
"/rdf:RDF/rdf:Description/fedora:created", ns)
.to("mock:filter")
.to(fcrepo_uri)
.to("mock:container");
from("direct:includeContainment")
.to(fcrepo_uri + "?preferInclude=PreferContainment")
.filter().xpath(
"/rdf:RDF/rdf:Description/ldp:contains", ns)
.to("mock:filter");
from("direct:omitContainmentShort")
.to(fcrepo_uri + "?preferOmit=PreferContainment")
.filter().xpath(
"/rdf:RDF/rdf:Description/ldp:contains", ns)
.to("mock:filter");
from("direct:omitContainmentFull")
.to(fcrepo_uri + "?preferOmit=PreferContainment")
.filter().xpath(
"/rdf:RDF/rdf:Description/ldp:contains", ns)
.to("mock:filter");
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");
}
};
}
示例5: createRouteBuilder
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
@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);
ns.add("premis", PREMIS);
ns.add("fedora", REPOSITORY);
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 + "Binary']", ns)
.to("mock:filter")
.to(fcrepo_uri + "?metadata=false")
.to("mock:binary");
from("direct:getFixity")
.to(fcrepo_uri + "?fixity=true")
.filter().xpath(
"/rdf:RDF/rdf:Description/rdf:type" +
"[@rdf:resource='" + PREMIS + "Fixity']", ns)
.to("mock:fixity")
.filter().xpath(
"/rdf:RDF/rdf:Description/premis:hasMessageDigest" +
"[@rdf:resource='urn:sha1:12f68888e3beff267deae42ea86058c9c0565e36']", ns)
.to("mock:fixity")
.filter().xpath(
"/rdf:RDF/rdf:Description/premis:hasEventOutcome" +
"[text()='SUCCESS']", ns)
.to("mock:fixity");
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");
}
};
}
示例6: createRouteBuilder
import org.apache.camel.builder.xml.Namespaces; //导入方法依赖的package包/类
@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);
ns.add("dc", "http://purl.org/dc/elements/1.1/");
from("direct:create")
.to(fcrepo_uri)
.to("mock:created");
from("direct:patch")
.setHeader(Exchange.HTTP_METHOD, constant("PATCH"))
.to(fcrepo_uri)
.to("mock:operation");
from("direct:title")
.to(fcrepo_uri)
.convertBodyTo(org.w3c.dom.Document.class)
.filter().xpath(
"/rdf:RDF/rdf:Description/rdf:type" +
"[@rdf:resource='" + REPOSITORY + "Container']", ns)
.to("mock:filter")
.split().xpath(
"/rdf:RDF/rdf:Description/dc:title/text()", ns)
.to("mock:title");
from("direct:delete")
.setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
.to(fcrepo_uri)
.to("mock:operation")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.to(fcrepo_uri + "?throwExceptionOnFailure=false")
.to("mock:verifyGone");
}
};
}