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
Merge pull request #20 from cloudant/24614-attachments-api

FB 24614: Basic attachments API and push/pull

This PR covers basic CRUD for attachments (API in https://gist.github.com/mikerhodes/8c50371a933f26760612) and push/pull of attachments through inline base64.

Not done in this PR: multipart/related or other performance tricks like fetching attachment separately so they can be fetched unencoded and gzipped if appropriate.