Skip to content

Instantly share code, notes, and snippets.

@bibryam
Created July 24, 2012 10:56
Show Gist options
  • Select an option

  • Save bibryam/3169385 to your computer and use it in GitHub Desktop.

Select an option

Save bibryam/3169385 to your computer and use it in GitHub Desktop.
Camel CMIS Demos
public class CamelCmisFileUploader extends RouteBuilder {
public void configure() {
from("file:src/demo?noop=true")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
exchange.getIn().getHeaders().put(PropertyIds.NAME, exchange.getIn().getHeader(Exchange.FILE_NAME));
exchange.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, "/demo");
}
})
.to("cmis://http://cmis.alfresco.com/cmisatom?repositoryId=371554cd-ac06-40ba-98b8-e6b60275cca7&username={{username}}&password={{password}}");
}
}
public class CamelCmisQueryProducer extends RouteBuilder {
public void configure() {
from("timer://foo?repeatCount=1")
.setBody(constant("SELECT * FROM cmis:document WHERE cmis:name LIKE '%camel%'"))
.to("cmis://http://cmis.demo.nuxeo.org/nuxeo/atom/cmis&username={{username}}&password={{password}}&queryMode=true&readContent=true")
.split(body())
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
Map<String, Object> body = (Map<String, Object>)exchange.getIn().getBody();
exchange.getIn().getHeaders().put(Exchange.FILE_NAME, body.get(PropertyIds.NAME));
exchange.getIn().setBody(body.get(CamelCMISConstants.CAMEL_CMIS_CONTENT_STREAM));
}
})
.to("file:src/demo");
}
}
public class CamelCmisRepositoryReplication extends RouteBuilder {
public void configure() {
from("cmis://http://cmis.alfresco.com/cmisatom?repositoryId=371554cd-ac06-40ba-98b8-e6b60275cca7&username={{username}}&password={{password}}&readContent=true")
.to("cmis://http://cmis.demo.nuxeo.org/nuxeo/atom/cmis?username={{username}}&password={{password}}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment