Issue
The camel FTP component allows to set chmod property (see Apache Camel: FTP2) on stored files. Is there a way to do the same with the camel file component ?
Something like from("somewhere").to("file:foo.txt?chmod=666")
.
If not, do you know a nice way to do that with camel ?
Solution
Permissions in FTP is pretty straight forward with chmod style. Permisson on files are not really as simple (with all file systems and OS implementations out there). To my knowledge, there is nothing like that directly in the Camel file endpoint.
But, if you know the deployment platform, you can use the exec component to make a call to, say chmod 666 myfile.txt
after it has been created, either in the route or in a route policy. There are some ways directly in java, but there is no golden way to do this, at least not platform independent. Look at this SO How can I set the umask from within java?.
Answered By - Petter Nordlander Answer Checked By - Willingham (WPSolving Volunteer)