-
Notifications
You must be signed in to change notification settings - Fork 2
/
06-ThumbnailGenerator.xml
53 lines (48 loc) · 2.38 KB
/
06-ThumbnailGenerator.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:fedora="http://fedora.info/definitions/v4/repository#"
xmlns:ebucore="http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#">
<route id="thumbnailRouter">
<from uri="activemq:topic:fedora"/>
<log message="GOT A MESSAGE: ${headers}"/>
<filter>
<simple>
${header[org.fcrepo.jms.eventType]} != 'http://fedora.info/definitions/v4/repository#NODE_REMOVED' &&
${header[org.fcrepo.jms.properties]} contains 'http://fedora.info/definitions/v4/repository#hasContent'
</simple>
<to uri="fcrepo:localhost:8080/fcrepo/rest"/>
<setProperty propertyName="mimetype">
<xpath>/rdf:RDF/rdf:Description/ebucore:hasMimeType/text()</xpath>
</setProperty>
<setProperty propertyName="parent">
<xpath>/rdf:RDF/rdf:Description/fedora:hasParent/@rdf:resource</xpath>
</setProperty>
<filter>
<simple>${property.mimetype} == 'image/jpeg'</simple>
<log message="PARENT URI: ${property.parent}"/>
<to uri="direct:generateThumbnail"/>
</filter>
</filter>
<to uri="mock:result"/>
</route>
<route id="thumbnailGenerate">
<from uri="direct:generateThumbnail"/>
<to uri="fcrepo:localhost:8080/fcrepo/rest?metadata=false"/>
<to uri="exec:convert?args=-thumbnail 100x100 - png:-"/>
<to uri="direct:upsertThumbnail"/>
</route>
<route id="thumbnailUpsert">
<from uri="direct:upsertThumbnail"/>
<removeHeaders pattern="*"/>
<setHeader headerName="CamelHttpMethod"><constant>PUT</constant></setHeader>
<setHeader headerName="Content-Type"><constant>image/png</constant></setHeader>
<recipientList><simple>fcrepo:${property.parent}/thumbnail</simple></recipientList>
</route>
</camelContext>
</blueprint>