Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleCamel Route using the JAVA DSL
linenumberstrue
XPathBuilder xpath = new XPathBuilder("/rdf:RDF/rdf:Description/rdf:type[@rdf:resource='http://fedora.info/definitions/v4/indexing#Indexable']")
xpath.namespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")

from("activemq:topic:fedora")
  .to("fcrepo:localhost:8080/fedora/rest")
  .filter(xpath)
  .to("fcrepo:localhost:8080/fedora/rest?accept=application/json&transform=default")
  .to("http4:localhost:8080/solr/core/update");

...

Code Block
languagexml
titleCamel Route using the Spring DSL
linenumberstrue
<route>
  <from uri="activemq:topic:fedora"/>
  <to uri="fcrepo:localhost:8080/fedora/rest"/>
  <filter>
    <xpath>/rdf:RDF/rdf:Description/rdf:type[@rdf:resource='http://fedora.info/definitions/v4/indexing#Indexable']</xpath>
    <to uri="fcrepo:localhost:8080/fedora/rest?accept=application/json&transform=default"/>
    <to uri="http4:localhost:8080/solr/core/update"/>
  </filter>
</route>

...

Code Block
languagescala
titleCamel Route using the Scala DSL
linenumberstrue
val xpath = new XPathBuilder("/rdf:RDF/rdf:Description/rdf:type[@rdf:resource='http://fedora.info/definitions/v4/indexing#Indexable']")
xpath.namespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
 
"activemq:topic:fedora" ==> {
    to("fcrepo:localhost:8080/fedora/rest")
    filter(xpath) {
        to("fcrepo:localhost:8080/fedora/rest?accept=application/json&transform=default")
        to("http4:localhost:8080/solr/core/update")
    }
}

...

Code Block
languagescala
titleCamel route to populate a Riak store, using the Scala DSL
linenumberstrue
val riakKeyProcessor = (exchange: Exchange) => {
	exchange.getIn.setHeader(
		Exchange.HTTP_PATH,
		"/buckets/fcrepo/keys/" + URLEncoder.encode(exchange.getIn.getHeader("org.fcrepo.jms.identifier", classOf[String]))
	)
}
 
"activemq:topic:fedora" ==> {
	choice() {
		when(_.in("org.fcrepo.jms.eventType") == "http://fedora.info/definitions/v4/repository#NODE_REMOVED") {
			setHeader(Exchange.HTTP_METHOD, constant("DELETE"))
			process(riakKeyProcessor)
			to("http4:localhost:8098")
		}
		otherwise() {
		    to("fcrepo:localhost:8080/fedora/rest")
			filter(xpathFilter) {
                to("fcrepo:localhost:8080/fedora/rest?accept=application/json&transform=mytransform")
	      	    setHeader(Exchange.HTTP_METHOD, constant("PUT"))
		        process(riakKeyProcessor)
                to("http4:localhost:8098")
			}
		}
	}
}

...

  1. downloading Karaf from an apache.org mirror
  2. running ./bin/karaf to enter the shell
  3. installing required bundles (n.b. the following commands correspond to Karaf 3.x. For Karaf 2.x installations, please refer to the Karaf 2.x documentation):

    Code Block
    languagebash
    titleKaraf console
    $> feature:repo-add camel 2.14.0
    $> feature:repo-add activemq 5.10.0
    $> feature:install camel
    $> feature:install activemq-camel
    
    # display available camel features
    $> feature:list | grep camel
    
    # install camel features, as needed
    $> feature:install camel-http4
     
    # install fcrepo-camel (as of v4.0.1)
    $> feature:repo-add mvn:org.fcrepo.camel/fcrepo-camel/4.0.1/xml/features
    $> feature:install fcrepo-camel
  4. setting up a service wrapper (so that karaf runs as a system-level service)

    Code Block
    languagebash
    titleKaraf console
    $> feature:install wrapper
    $> wrapper:install
  5. following the directions provided by this command

...