Design pattern for file based communication?
I have to extend an existing program (Java-based, but this shouldn't count). This program should communicate with another program X.
This program X is .. uhm.. a little bit older and supports only file based communication. This means I have to put my file into some specific folder. The "answer" is plac开发者_如何学编程ed in another folder where I have to pick it up.
Are there any design patterns for this kind of communication? Problems with file-locking, unflushed io-streams etc. come to my mind if I think about it.
Do you have some more descriptive keywords for my googleing? "file based communication" doesn't take it.
Maybe Producer-Consumer pattern is what you want.
I belive you'll find better articles then the article in wikipedia. But main concepts are described there clear enough (just replace 'buffer' with 'file' for your concrete case).
I don't know if it is possible to create file system watchers in java (like it is in C#), but I do always use a file system watcher to monitor the folder which receives files.
精彩评论