Initial checkin of Attachments API:

* Attachments code lives in AttachmentManager and
  are called by facade methods in BasicDatastore

* Basic implementation and tests for push
  replication
Update schema for encoding, encoded_length
Code to add pulled attachments to local file store
* Better IO exception handling
* Some tests for larger/binary files
Fixup some helper fns that were not marked @Test
Fix schema generation so UUIDs are unique (again)
Add message to asserts
Address some PR review comments:
* Licence headers missing on files
* Line length
* Logging
* Fix/clarify comments to reflect code
* More unit tests
* Some logic fixes
Fix Javadoc comments
Use helper method datastore.createAttachment
Add purgeAttachments
Delay attachment purging until compact() is called
Make updateAttachments more transactional
Simplify attachment deletion so it all happens in one query

Also move makePlaceholders to SQLDatabaseUtils
Split unsaved attachment into stream and file-based classes
Some logging/error handling improvements
Add licence header
Update test file in fixtures
Add PreparedAttachment class

This allows us to prepare an attachment up-front
by copying it to a temp location and calculating
the SHA1 outside of the database transaction
Remove createAttachment after review