Java Examples for org.apache.camel.Exchange.FILE_NAME

The following java examples will help you to understand the usage of org.apache.camel.Exchange.FILE_NAME. These source code samples are taken from different open source projects.

Example 1
Project: fcrepo-camel-toolbox-master  File: SerializationRouter.java View source code
/**
     * Configure the message route workflow
     *
     */
public void configure() throws Exception {
    final Namespaces ns = new Namespaces("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#").add("fedora", REPOSITORY);
    /**
         * A generic error handler (specific to this RouteBuilder)
         */
    onException(Exception.class).maximumRedeliveries("{{error.maxRedeliveries}}").log("Index Routing Error: ${routeId}");
    /**
         * Handle Serialization Events
         */
    from("{{input.stream}}").routeId("FcrepoSerialization").process(new EventProcessor()).process( exchange -> {
        final String uri = exchange.getIn().getHeader(FCREPO_URI, "", String.class);
        exchange.getIn().setHeader(SERIALIZATION_PATH, create(uri).getPath());
    }).filter(not(in(uriFilter))).choice().when(or(header(FCREPO_EVENT_TYPE).contains(RESOURCE_DELETION), header(FCREPO_EVENT_TYPE).contains(DELETE))).to("direct:delete").otherwise().multicast().to("direct:metadata", "direct:binary");
    from("{{serialization.stream}}").routeId("FcrepoReSerialization").filter(not(in(uriFilter))).process( exchange -> {
        final String uri = exchange.getIn().getHeader(FCREPO_URI, "", String.class);
        exchange.getIn().setHeader(SERIALIZATION_PATH, create(uri).getPath());
    }).multicast().to("direct:metadata", "direct:binary");
    from("direct:metadata").routeId("FcrepoSerializationMetadataUpdater").to("fcrepo:localhost?accept={{serialization.mimeType}}").log(INFO, LOGGER, "Serializing object ${headers[CamelFcrepoUri]}").setHeader(FILE_NAME).simple("${headers[CamelSerializationPath]}.{{serialization.extension}}").log(DEBUG, LOGGER, "filename is ${headers[CamelFileName]}").to("file://{{serialization.descriptions}}");
    from("direct:binary").routeId("FcrepoSerializationBinaryUpdater").filter().simple("{{serialization.includeBinaries}} == 'true'").to("fcrepo:localhost?preferInclude=PreferMinimalContainer" + "&accept=application/rdf+xml").filter().xpath(isBinaryResourceXPath, ns).log(INFO, LOGGER, "Writing binary ${headers[CamelSerializationPath]}").to("fcrepo:localhost?metadata=false").setHeader(FILE_NAME).header(SERIALIZATION_PATH).log(DEBUG, LOGGER, "header filename is: ${headers[CamelFileName]}").to("file://{{serialization.binaries}}");
    from("direct:delete").routeId("FcrepoSerializationDeleter").setHeader(EXEC_COMMAND_ARGS).simple("-rf {{serialization.descriptions}}${headers[CamelSerializationPath]}.{{serialization.extension}} " + "{{serialization.descriptions}}${headers[CamelSerializationPath]} " + "{{serialization.binaries}}${headers[CamelSerializationPath]}").to("exec:rm");
}
Example 2
Project: camel-master  File: SimpleTest.java View source code
public void testTypeConstant() throws Exception {
    assertExpression("${type:org.apache.camel.Exchange.FILE_NAME}", Exchange.FILE_NAME);
    assertExpression("${type:org.apache.camel.ExchangePattern.InOut}", ExchangePattern.InOut);
    // non existing fields
    assertExpression("${type:org.apache.camel.ExchangePattern.}", null);
    assertExpression("${type:org.apache.camel.ExchangePattern.UNKNOWN}", null);
}