Exempt hints from checks on the owner side
package won.owner.camel.routes;
+import java.net.URI;
+
import org.apache.camel.CamelContext;
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.builder.PredicateBuilder;
import org.apache.camel.builder.RouteBuilder;
-import java.net.URI;
-import java.util.List;
+import won.protocol.message.processor.camel.WonCamelConstants;
+import won.protocol.vocabulary.WONMSG;
//TODO: This route builder should not be loaded on startup, but it's being loaded..
/**
@@ -58,13 +62,27 @@ public class OwnerApplicationListenerRouteBuilder extends RouteBuilder {
.to("bean:wonMessageIntoCamelProcessor")
.to("bean:wellformednessChecker")
.to("bean:uriNodePathChecker")
+ .choice()
+ .when(header(WonCamelConstants.MESSAGE_TYPE_HEADER).isEqualTo(URI.create(WONMSG.TYPE_HINT_STRING)))
+ //don't check the signature if we're processing a hint message (until the matcher signs its messages)
+ .log(LoggingLevel.DEBUG,"not checking signature because we're processing a hint message)")
+ .to("bean:linkedDataCacheInvalidator")
+ .to("bean:linkedDataCacheUpdater")
+ //this expects a bean with name 'mainOwnerMessageProcessor' in the application context
+ //this bean is *not* provided by the won-owner module. This allows the definition of a
+ //different processing chain depending on the use case.
+ .to("bean:mainOwnerMessageProcessor")
+ .otherwise()
+ .log(LoggingLevel.DEBUG, "checking signature because we're not processing a hint message)")
.to("bean:signatureChecker")
.to("bean:linkedDataCacheInvalidator")
.to("bean:linkedDataCacheUpdater")
//this expects a bean with name 'mainOwnerMessageProcessor' in the application context
//this bean is *not* provided by the won-owner module. This allows the definition of a
//different processing chain depending on the use case.
- .to("bean:mainOwnerMessageProcessor");
+ .to("bean:mainOwnerMessageProcessor")
+ .end();
+
}
