Adding ability to upload files on s3.

To enable file upload on S3 you need to enable the configuration setting in c_configuration table for s3.
The S3 credentials (access_key, secret_key, bucket_name) in a m_external_services table.
m_client table is normalised into m_client and m_image table. The relation between m_client and m_image is one-to-one for now.
To persist the storage type(s3 or filesystem) a column had been added to m_document.

MISOFX-69 Adding db migrations for s3 support

MIFOSX-69 Adding method to return boolean value of S3 config

MIFOSX-69 - Priti/Harsha - Refactoring Code, extracted interface for Documents upload

MIFOSX-69 Refactored to add S3 Support for file upload. Modified saveDocs to throw Document Management Exception instead of IO exception

MIFOSX-69 Adding S3 support for file upload

MIFOSX-69 - Adding S3 support for Image upload

MIFOSX-69 Adding factory to get instance of data store as per s3 configuration

MIFOSX-69 Changing table s3_details to generic tabe for external services, adding column to store the storage type in m_documents table

MIFOSX-69 Fetching S3 details from database

MIFOSX-69 Adding document storage type while creating a document

MIFOSX-69 Normalising client table to create an image table

Refactoring ClientImage code to save client image in m_image table

Refactored code to get document as file

MIFOSX-69 Retreiving documents from S3

MIFOSX-69 Refactored ClientData to store ImageData

MIFOSX-69 Retrieving images from S3, Modifying Base64 to encode from byte array instead of file in CLientImagesApiResource

MIFOSX-69 Refactored code to delete client image

MIFOSX-69 Deleting Images from S3

Refactored DocumentStore to return StoreType from string value

MIFOSX-69 Refactored to move document deletion responsibility to storageType

MIFOSX-69 Giving more appropriate name to getInstance methods of DocumentStoreFactory as per the instance creation criteria

MIFOSX-69 Deleting Documents from S3

MIFOSX-69 Removing unnecessary s3_param from migration

MIFOSX-69 Adding ability to update document and update doc store type

MIFOSX-69 Renaming method to follow java conventions

MIFOSX-69 Adding filename to error log for s3 file retrieval

Adding data migrations and changing the version for migration file
This commit is contained in:
Harshac
2013-06-03 10:29:30 +05:30
committed by Vishwas Babu AJ
parent 14c8eabdcc
commit 9c1f9cd912
38 changed files with 1517 additions and 494 deletions
@@ -0,0 +1,28 @@
INSERT INTO c_configuration (name,enabled) VALUES ('amazon-S3',0);
CREATE TABLE IF NOT EXISTS m_external_services (
name VARCHAR(150) NOT NULL,
value VARCHAR(250),
UNIQUE(name)
);
INSERT INTO m_external_services (name) VALUES ('s3_bucket_name');
INSERT INTO m_external_services (name) VALUES ('s3_access_key');
INSERT INTO m_external_services (name) VALUES ('s3_secret_key');
ALTER TABLE m_document ADD COLUMN storage_type varchar(50);
CREATE TABLE IF NOT EXISTS `m_image`(
`id` BIGINT NOT NULL AUTO_INCREMENT,
`client_id` BIGINT NOT NULL,
`key` varchar(500),
`storage_type` varchar(50),
FOREIGN KEY (`client_id`) REFERENCES m_client(`id`),
PRIMARY KEY (`id`),
UNIQUE(client_id)
);
UPDATE m_document set storage_type='file_system';
insert into m_image (`client_id`,`key`,`storage_type`) select id,`image_key`,'file_system' from m_client where `image_key` IS NOT NULL;