Commit d6b437df authored by birkland's avatar birkland Committed by acoburn
Browse files

Apix demo rebase (#1)

* Update exts services for API-X demo

- Update extension definition to comply with current ontology
- Expose as resource-scoped in most cases by default
- Add auto registering of extensions
- Use apix headers rather than http paths for identity of Fedora objects

Mostly involves allowing both path-based and api-x header-based routing in
-exts.  The existing integration tests use path-based paradigm.
parent 67ff1a4f
......@@ -10,4 +10,4 @@ rest.port=9106
rest.host=localhost
# The endpoint for the FITS server
fits.endpoint=localhost:8080/fits
fits.endpoint=localhost:8080/fits/examine
......@@ -51,8 +51,10 @@ public class FitsRouter extends RouteBuilder {
.routeId("AcrepoFitsRest")
.routeDescription(
"FITS service to gather technical information about a binary located in a Fedora repository.")
.process(e -> e.getIn().setHeader(FEDORA_PATH,
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH))))
.log(INFO, LOGGER, "Received request for Fits data for: ${headers[CamelHttpPath]}")
.setHeader(FEDORA_PATH).header(HTTP_PATH)
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.to("direct:fitsService")
......@@ -66,6 +68,7 @@ public class FitsRouter extends RouteBuilder {
.log(INFO, LOGGER, "FitsFedoraLookup - fetching ${headers[CamelHttpPath]}")
.setHeader(HTTP_METHOD).constant("HEAD")
.setHeader(HTTP_URI).simple("http://{{fcrepo.baseUrl}}")
.setHeader(HTTP_PATH, header(FEDORA_PATH))
.to("http4://{{fcrepo.baseUrl}}?authUsername={{fcrepo.authUsername}}" +
"&authPassword={{fcrepo.authPassword}}&throwExceptionOnFailure=false")
.choice()
......
......@@ -17,6 +17,9 @@
<cm:property name="rest.host" value="localhost"/>
<cm:property name="rest.port" value="9106"/>
<cm:property name="fits.endpoint" value="localhost:8080/fits/examine"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
......@@ -24,6 +27,31 @@
<package>edu.amherst.acdc.exts.fits</package>
<!-- Self-register the loader service as an extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setBody>
<simple>http://{{rest.host}}:{{rest.port}}{{rest.prefix}}</simple>
</setBody>
<choice>
<when>
<simple>{{extension.load}}</simple>
<to
uri="jetty:{{extension.load.uri}}?okStatusCodeRange=200-399" />
</when>
</choice>
</route>
</camelContext>
......
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
@prefix fedora:<http://fedora.info/definitions/v4/repository#> .
@prefix registry:<http://acdc.amherst.edu/extensions#> .
[ owl:equivalentClass fedora:Binary ] .
<> a apix:Extension;
apix:exposesService registry:fits;
apix:exposesServiceAt "svc:fits";
apix:bindsTo fedora:Binary .
\ No newline at end of file
......@@ -28,7 +28,10 @@ import static org.fcrepo.camel.FcrepoHeaders.FCREPO_IDENTIFIER;
import static org.slf4j.LoggerFactory.getLogger;
import java.io.InputStream;
import java.util.Collection;
import java.util.HashSet;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.slf4j.Logger;
......@@ -40,11 +43,11 @@ import org.slf4j.Logger;
*/
public class EventRouter extends RouteBuilder {
private final String IMAGE_OUTPUT = "CamelImageOutput";
private final String IMAGE_INPUT = "CamelImageInput";
private final String HTTP_ACCEPT = "Accept";
private final String DEFAULT_OUTPUT_FORMAT = "jpeg";
private final String HTTP_QUERY_OPTIONS = "options";
private static final String IMAGE_OUTPUT = "CamelImageOutput";
private static final String IMAGE_INPUT = "CamelImageInput";
private static final String HTTP_ACCEPT = "Accept";
private static final String DEFAULT_OUTPUT_FORMAT = "jpeg";
private static final String HTTP_QUERY_OPTIONS = "options";
private static final Logger LOGGER = getLogger(EventRouter.class);
......@@ -56,12 +59,13 @@ public class EventRouter extends RouteBuilder {
from("jetty:http://{{rest.host}}:{{rest.port}}{{rest.prefix}}?" +
"matchOnUriPrefix=true&sendServerVersion=false&httpMethodRestrict=GET,OPTIONS")
.routeId("ImageRouter")
.setHeader(FCREPO_IDENTIFIER).header(HTTP_PATH)
.process(e -> e.getIn().setHeader(FCREPO_IDENTIFIER,
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH))))
.setHeader(IMAGE_OUTPUT).header(HTTP_ACCEPT)
.removeHeaders(HTTP_ACCEPT)
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.setHeader(FCREPO_IDENTIFIER).header(HTTP_PATH)
.to("direct:get")
.when(header(HTTP_METHOD).isEqualTo("OPTIONS"))
.setHeader(CONTENT_TYPE).constant("text/turtle")
......@@ -70,6 +74,7 @@ public class EventRouter extends RouteBuilder {
from("direct:get")
.routeId("ImageGet")
.setHeader(HTTP_PATH, header(FCREPO_IDENTIFIER))
.setHeader(HTTP_METHOD).constant("HEAD")
.setHeader(HTTP_URI).simple("http://{{fcrepo.baseUrl}}")
.to("http4://{{fcrepo.baseUrl}}?authUsername={{fcrepo.authUsername}}" +
......@@ -120,7 +125,7 @@ public class EventRouter extends RouteBuilder {
if (valid) {
exchange.getIn().setHeader(IMAGE_OUTPUT, "image/" + fmt);
exchange.getIn().setHeader(EXEC_COMMAND_ARGS,
" - " + exchange.getIn().getHeader(HTTP_QUERY_OPTIONS, "", String.class) + " " + fmt + ":-");
" - " + cmdOptions(exchange) + " " + fmt + ":-");
} else {
throw new RuntimeCamelException("Invalid format: " + fmt);
}
......@@ -132,4 +137,17 @@ public class EventRouter extends RouteBuilder {
exchange.getOut().setBody(exchange.getIn().getBody(InputStream.class));
});
}
// Hack - cmdline options are often an array of repeated elements. Fix that
@SuppressWarnings("unchecked")
static final String cmdOptions(final Exchange e) {
final Object optHdr = e.getIn().getHeader(HTTP_QUERY_OPTIONS);
if (optHdr instanceof Collection) {
return String.join(" ", new HashSet<>((Collection<String>) optHdr));
} else if (optHdr != null) {
return (String) optHdr;
}
return "";
}
}
......@@ -18,11 +18,40 @@
<cm:property name="fcrepo.authPassword" value=""/>
<cm:property name="convert.path" value="convert"/>
<cm:property name="valid.formats" value="jpeg,jp2,tiff"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
<camelContext id="AcrepoImageService" xmlns="http://camel.apache.org/schema/blueprint">
<package>edu.amherst.acdc.exts.image</package>
<!-- Self-register the loader service as an extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setBody>
<simple>http://{{rest.host}}:{{rest.port}}{{rest.prefix}}</simple>
</setBody>
<choice>
<when>
<simple>{{extension.load}}</simple>
<to
uri="jetty:{{extension.load.uri}}?okStatusCodeRange=200-399" />
</when>
</choice>
</route>
</camelContext>
</blueprint>
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
@prefix owl:<http://www.w3.org/2002/07/owl#> .
@prefix ebucore:<http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix fedora:<http://fedora.info/definitions/v4/repository#> .
@prefix registry:<http://acdc.amherst.edu/extensions#> .
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix registry: <http://acdc.amherst.edu/extensions#> .
@prefix apix: <urn:apix#> .
<#Extension> a apix:Extension ;
rdfs:label "Image Manipulation Service" ;
rdfs:comment "A service that can manipulate Fedora binary resources that happen to be images" ;
apix:exposesService registry:ImageService ;
apix:exposesServiceAtURI "svc:image" ;
apix:bindsTo [
owl:unionOf (
fedora:Binary
[ a owl:Restriction ; owl:onProperty ebucore:mimeType ; owl:hasValue "image/tiff" ]
[ a owl:Restriction ; owl:onProperty ebucore:mimeType ; owl:hasValue "image/jpeg" ]
[ a owl:Restriction ; owl:onProperty ebucore:mimeType ; owl:hasValue "image/jp2" ] ) ] .
<> a apix:Extension;
rdfs:label "Image Manipulation Service";
rdfs:comment "A service that can manipulate Fedora binary resources that happen to be images";
apix:exposesService registry:ImageService;
apix:exposesServiceAt "svc:image";
apix:bindsTo <#class> .
<#class> owl:intersectionOf (
fedora:Binary
[ a owl:Restriction; owl:onProperty ebucore:hasMimeType; owl:hasValue "image/tiff", "image/jpeg", "image/jp2" ]
) .
......@@ -42,12 +42,18 @@ public class EventRouter extends RouteBuilder {
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.log("JSONLD Processing ${headers[CamelHttpPath]}")
.setHeader(FCREPO_IDENTIFIER).header(HTTP_PATH)
.process(e -> e.getIn().setHeader(FCREPO_IDENTIFIER,
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH))))
.to("direct:get")
.when(header(HTTP_METHOD).isEqualTo("OPTIONS"))
.setHeader(CONTENT_TYPE).constant("text/turtle")
.setHeader("Allow").constant("GET,OPTIONS")
.to("language:simple:resource:classpath:options.ttl");
.choice()
.when(header("apix.scope").isEqualTo("resource"))
.to("language:simple:resource:classpath:options_resource.ttl")
.otherwise()
.to("language:simple:resource:classpath:options.ttl");
from("direct:get")
.routeId("JsonLdGet")
......
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
@prefix fedora:<http://fedora.info/definitions/v4/repository#> .
@prefix registry:<http://acdc.amherst.edu/extensions#> .
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix registry: <http://acdc.amherst.edu/extensions#> .
@prefix apix: <urn:apix#> .
<#Extension> a apix:Extension ;
rdfs:label "JSON-LD Compaction Service" ;
rdfs:comment "A service that transforms RDFSource documents to compact JSON-LD" ;
apix:exposesService registry:JsonLDService ;
apix:exposesServiceAtURI "svc:compact" ;
<> a apix:Extension;
rdfs:label "JSON-LD Compaction Service";
rdfs:comment "A service that transforms RDFSource documents to compact JSON-LD";
apix:exposesService registry:JsonLDService;
apix:exposesServiceAt "/svc:compact";
apix:bindsTo fedora:Resource .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
@prefix fedora:<http://fedora.info/definitions/v4/repository#> .
@prefix registry:<http://acdc.amherst.edu/extensions#> .
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
<> a apix:Extension;
rdfs:label "JSON-LD Compaction Service";
rdfs:comment "A service that transforms RDFSource documents to compact JSON-LD";
apix:exposesService registry:JsonLDService;
apix:exposesServiceAt "svc:compact";
apix:bindsTo fedora:Resource .
......@@ -51,7 +51,6 @@ public class PcdmRouter extends RouteBuilder {
.removeHeader("User-Agent")
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.log("Building PCDM Object ${headers[CamelHttpPath]}")
.to("direct:get")
.when(header(HTTP_METHOD).isEqualTo("OPTIONS"))
.setHeader(CONTENT_TYPE).constant("text/turtle")
......@@ -61,7 +60,10 @@ public class PcdmRouter extends RouteBuilder {
from("direct:get")
.routeId("PcdmGet")
.setHeader(PCDM_ACCEPT, header("Accept"))
.setBody(header(HTTP_PATH))
.process(e -> e.getIn().setBody(
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH))))
.log("Building PCDM Object ${body}")
.setHeader(FCREPO_BASE_URL).simple("{{fcrepo.baseUrl}}")
.to("seda:recurse")
.removeHeader("breadcrumbId")
......
......@@ -15,6 +15,9 @@
<cm:property name="rest.host" value="localhost"/>
<cm:property name="pcdm.concurrency" value="10"/>
<cm:property name="fcrepo.baseUrl" value="http://localhost:8080/fcrepo/rest"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
......@@ -57,6 +60,32 @@
<method ref="pcdmService" method="serialize(${header[CamelPcdmModel]}, ${header[CamelPcdmAccept]})"/>
</setBody>
</route>
<!-- Self-register the loader service as an extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setBody>
<simple>http://{{rest.host}}:{{rest.port}}{{rest.prefix}}</simple>
</setBody>
<choice>
<when>
<simple>{{extension.load}}</simple>
<to
uri="jetty:{{extension.load.uri}}?okStatusCodeRange=200-399" />
</when>
</choice>
</route>
</camelContext>
......
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix owl:<http://www.w3.org/2002/07/owl#> .
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix registry: <http://acdc.amherst.edu/extensions#> .
@prefix pcdm: <http://pcdm.org/models#> .
@prefix apix: <urn:apix#> .
@prefix fedora:<http://fedora.info/definitions/v4/repository#> .
@prefix registry:<http://acdc.amherst.edu/extensions#> .
@prefix pcdm:<http://pcdm.org/models#> .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
<#Extension> a apix:Extension ;
rdfs:label "PCDM Object extension" ;
rdfs:comment "An extension that builds an entire PCDM object" ;
apix:exposesService registry:PcdmService ;
apix:exposesServiceAtURI "svc:pcdm" ;
<> a apix:Extension;
rdfs:label "PCDM Object extension";
rdfs:comment "An extension that builds an entire PCDM object";
apix:exposesService registry:PcdmService;
apix:exposesServiceAt "svc:pcdm";
apix:bindsTo pcdm:Object .
......@@ -35,23 +35,18 @@ public class EventRouter extends RouteBuilder {
*/
public void configure() throws Exception {
from("jetty:http://{{rest.host}}:{{rest.port}}/dc?" +
from("jetty:http://{{rest.host}}:{{rest.port}}{{rest.prefix}}?" +
"matchOnUriPrefix=true&httpMethodRestrict=GET,OPTIONS&sendServerVersion=false")
.routeId("XmlDcTransformation")
.routeId("XmlAccept")
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.to("direct:dc")
.when(header(HTTP_METHOD).isEqualTo("OPTIONS"))
.to("direct:options");
from("jetty:http://{{rest.host}}:{{rest.port}}/mods?" +
"matchOnUriPrefix=true&httpMethodRestrict=GET,OPTIONS&sendServerVersion=false")
.routeId("XmlModsTransformation")
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.to("direct:options")
.when(header(HTTP_PATH).contains("dc"))
.to("direct:dc")
.when(header(HTTP_PATH).contains("mods"))
.to("direct:mods")
.when(header(HTTP_METHOD).isEqualTo("OPTIONS"))
.to("direct:options");
.otherwise()
.to("direct:choice");
from("direct:dc")
.routeId("XmlDcXslt")
......@@ -77,12 +72,20 @@ public class EventRouter extends RouteBuilder {
.setHeader("Allow").constant("GET,OPTIONS")
.to("language:simple:resource:classpath:options.ttl");
from("direct:choice")
.routeId("ChooseFormat")
.setHeader(CONTENT_TYPE).constant("text/html")
.setHeader("Allow").constant("GET,OPTIONS")
.to("language:simple:resource:classpath:index.html");
from("direct:getResource")
.routeId("XmlTransformationCommon")
.removeHeader("breadcrumbId")
.removeHeader("Accept")
.removeHeader("User-Agent")
.setHeader(FCREPO_IDENTIFIER).header(HTTP_PATH)
.process(e -> e.getIn().setHeader(FCREPO_IDENTIFIER,
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH, "", String.class).replaceFirst("^/.+?/", "/"))))
.setHeader(FCREPO_BASE_URL).simple("{{fcrepo.baseUrl}}")
.to("fcrepo:{{fcrepo.baseUrl}}?throwExceptionOnFailure=false");
......
......@@ -12,14 +12,44 @@
<cm:default-properties>
<cm:property name="rest.port" value="9104"/>
<cm:property name="rest.host" value="localhost"/>
<cm:property name="rest.prefix" value="/xml"/>
<cm:property name="mods.xslt" value="edu/amherst/acdc/exts/serialize/xml/rdf2mods.xsl"/>
<cm:property name="dc.xslt" value="edu/amherst/acdc/exts/serialize/xml/rdf2dc.xsl"/>
<cm:property name="fcrepo.baseUrl" value="http://localhost:8080/fcrepo/rest"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
<camelContext id="AcrepoExtsSerializeXml" xmlns="http://camel.apache.org/schema/blueprint">
<package>edu.amherst.acdc.exts.serialize.xml</package>
<!-- Self-register the loader service as an extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setBody>
<simple>http://{{rest.host}}:{{rest.port}}{{rest.prefix}}</simple>
</setBody>
<choice>
<when>
<simple>{{extension.load}}</simple>
<to
uri="jetty:{{extension.load.uri}}?okStatusCodeRange=200-399" />
</when>
</choice>
</route>
</camelContext>
</blueprint>
<html>
<body>
<h2>Pick a format</h2>
<div id="formats">
<div class="format"><a href="dc">Dublin Core</a></dov>
<div class="format"><a href="mods">MODS</a></div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -2,11 +2,11 @@
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix registry: <http://acdc.amherst.edu/extensions#> .
@prefix apix: <urn:apix#> .
@prefix apix:<http://fedora.info/definitions/v4/api-extension#> .
<#Extension> a apix:Extension ;
<> a apix:Extension ;
rdfs:label "XML Metadata Service" ;
rdfs:comment "A service that transforms RDFSource documents to plain XML (not RDF/XML)" ;
apix:exposesService registry:XmlMetadataService ;
apix:exposesServiceAtURI "svc:xmlmetadata" ;
apix:bindsTo pcdm:Object .
apix:exposesServiceAt "svc:xmlmetadata/" ;
apix:bindsTo fedora:Resource .
......@@ -15,7 +15,6 @@
*/
package edu.amherst.acdc.exts.serialize.xml;
import static org.apache.camel.Exchange.HTTP_PATH;
import static org.apache.camel.Exchange.HTTP_RESPONSE_CODE;
import static org.apache.camel.util.ObjectHelper.loadResourceAsStream;
import static org.apache.camel.builder.PredicateBuilder.and;
......@@ -133,7 +132,7 @@ public class RouteTest extends CamelBlueprintTestSupport {
final Map<String, Object> headers = new HashMap<>();
headers.put(HTTP_RESPONSE_CODE, 200);
headers.put(HTTP_PATH, "/acdc/manuscript");
headers.put("Apix-Ldp-Resource-Path", "/acdc/manuscript");
template.sendBodyAndHeaders("direct:start", loadResourceAsStream("resource.rdf"), headers);
assertMockEndpointsSatisfied();
......
......@@ -48,8 +48,10 @@ public class EventRouter extends RouteBuilder {
.routeId("TemplateTransformation")
.choice()
.when(header(HTTP_METHOD).isEqualTo("GET"))
.log("PATH: ${headers[CamelHttpPath]}")
.setHeader(FCREPO_IDENTIFIER).header(HTTP_PATH)
.process(e -> e.getIn().setHeader(FCREPO_IDENTIFIER,
e.getIn().getHeader("Apix-Ldp-Resource-Path",
e.getIn().getHeader(HTTP_PATH))))
.log("PATH: ${headers[CamelFcrepoIdentifier]}")
.removeHeader("breadcrumbId")
.removeHeader("Accept")
.removeHeader("User-Agent")
......
......@@ -18,6 +18,9 @@
<cm:property name="mustache.templateUri" value="edu/amherst/acdc/exts/template/template.mustache"/>
<cm:property name="mustache.contentType" value="text/html"/>
<cm:property name="jsonld.context" value="https://acdc.amherst.edu/jsonld/models.json"/>
<cm:property name="extension.load" value="true" />
<cm:property name="extension.load.uri" value="http://apix/services//apix:load" />
<cm:property name="extension.load.maximumRediveries" value="60" />
</cm:default-properties>
</cm:property-placeholder>
......@@ -35,6 +38,32 @@
<method ref="jsonldService" method="compact(${body}, ${header[JsonLdContext]})"/>
</setBody>
</route>
<!-- Self-register the loader service as an extension -->
<route id="load-extension">
<from uri="timer:register?repeatCount=1" />
<onException>
<exception>java.lang.Exception</exception>
<redeliveryPolicy maximumRedeliveries="{{extension.load.maximumRediveries}}"
logRetryAttempted="true" retryAttemptedLogLevel="INFO" />
</onException>
<setHeader headerName="Content-Type">
<constant>text/plain</constant>
</setHeader>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>