Created
July 24, 2012 10:56
-
-
Save bibryam/3169385 to your computer and use it in GitHub Desktop.
Camel CMIS Demos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}}"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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