Skip to content

Commit

Permalink
merge v2.3.0 (#45)
Browse files Browse the repository at this point in the history
* begin v2.3.0 development

Signed-off-by: Edi Permadi <[email protected]>

* added feature to get blob payload by path. close #43

Signed-off-by: Edi Permadi <[email protected]>

* added feature to create blob. close #44

Signed-off-by: Edi Permadi <[email protected]>

* update changelog

Signed-off-by: Edi Permadi <[email protected]>

* rename functions

Signed-off-by: Edi Permadi <[email protected]>

* added feature to retrieve blob metadata. close #25

Signed-off-by: Edi Permadi <[email protected]>

* added feature to update blob path. close #26

Signed-off-by: Edi Permadi <[email protected]>

* added feature to update blob payload. close #41

Signed-off-by: Edi Permadi <[email protected]>

* added feature to delete blob by uuid. close #24

Signed-off-by: Edi Permadi <[email protected]>

* rename functions

Signed-off-by: Edi Permadi <[email protected]>

* bump to v2.3.0

Signed-off-by: Edi Permadi <[email protected]>
  • Loading branch information
edipermadi authored Oct 23, 2017
1 parent b1ba082 commit 33568a3
Show file tree
Hide file tree
Showing 7 changed files with 507 additions and 83 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Blobfish Changelog

## v2.3.0 [October 23, 2017]

**New Features**

- Create blob
- Get blob payload by path
- Get blob metadata (by id or path)
- Update blob path
- Update blob payload
- Delete a blob

## v2.2.0 [October 22, 2017]

**Enhancement**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Image courtesy of [Blobby the Blobfish](http://thelastblobfish.tumblr.com/)
- [x] Import from blobfish container
- [ ] Export to blobfish container
- [x] Recipient CRUD access
- [ ] Blob CRUD access
- [x] Blob CRUD access
- [x] Tag CRUD access

## Blobfish Random Facts
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.edipermadi.security</groupId>
<artifactId>blobfish</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
151 changes: 109 additions & 42 deletions src/main/java/com/github/edipermadi/security/blobfish/pool/BlobPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,72 @@ public interface BlobPool {
void importPayload(InputStream inputStream, final X509Certificate certificate, final PrivateKey privateKey) throws BlobfishDecodeException, BlobfishCryptoException, IOException, CertificateException, SQLException;

/**
* List available tags
* Create a new tag
*
* @param tag new tag to be created
* @return UUID of new or existing tag
* @throws SQLException when inserting tag failed
*/
UUID createTag(String tag) throws SQLException;

/**
* List tags
*
* @param page number starts from 1
* @param size page size at least 1
* @return map of tag id and string
* @throws SQLException when reading tags failed
*/
Map<UUID, String> listAvailableTags(int page, int size) throws SQLException;
Map<UUID, String> listTags(int page, int size) throws SQLException;

/**
* List available blobs
* Get tag value by tag uuid
*
* @param tagId tag identifier
* @return tag value
* @throws SQLException when fetching tag value failed
*/
String getTag(UUID tagId) throws SQLException;

/**
* Update a tag
*
* @param tagId tag identifier
* @param tag new value of tag
* @return true when updated successfully
* @throws SQLException when updating tag failed
*/
boolean updateTag(UUID tagId, String tag) throws SQLException;

/**
* Delete a tag
*
* @param tagId tag identifier
* @return true when tag deleted successfully
* @throws SQLException when updating tag failed
*/
boolean deleteTag(UUID tagId) throws SQLException;

/**
* Create blob
*
* @param path blob path
* @param mimetype blob mimetype
* @param payload blob payload
* @return UUID of created blob
* @throws SQLException when inserting new blob failed
*/
UUID createBlob(String path, String mimetype, InputStream payload) throws SQLException;

/**
* List blobs
*
* @param page number starts from 1
* @param size page size at least 1
* @return map of blob uuid and corresponding metadata
* @throws SQLException when reading blob failed
*/
Map<UUID, Blob.SimplifiedMetadata> listAvailableBlobs(int page, int size) throws SQLException;
Map<UUID, Blob.SimplifiedMetadata> listBlobs(int page, int size) throws SQLException;

/**
* List blobs which has given tag
Expand All @@ -78,6 +126,26 @@ public interface BlobPool {
*/
Map<UUID, Blob.SimplifiedMetadata> listBlobsWithTag(UUID tagId, int page, int size) throws SQLException;

/**
* Add tag to a blob
*
* @param blobId blob identifier
* @param tagId tag identifier
* @return true when added successfully
* @throws SQLException when assigning tag failed
*/
boolean addTag(UUID blobId, UUID tagId) throws SQLException;

/**
* Remove tag from a blob
*
* @param blobId blob identifier
* @param tagId tag identifier
* @return true when removed successfully
* @throws SQLException when de-assigning tag failed
*/
boolean removeTag(UUID blobId, UUID tagId) throws SQLException;

/**
* Get tags of a particular blob
*
Expand All @@ -88,74 +156,73 @@ public interface BlobPool {
Map<UUID, String> getBlobTags(UUID blobId) throws SQLException;

/**
* Create a new tag
* Get blob payload by blob-uuid
*
* @param tag new tag to be created
* @return UUID of new or existing tag
* @throws SQLException when inserting tag failed
* @param blobId blob identifier
* @return byte array of blob
* @throws SQLException when reading payload failed
* @throws IOException when reading blob payload failed
*/
UUID createTag(String tag) throws SQLException;
byte[] getBlobPayload(UUID blobId) throws SQLException, IOException;

/**
* Get tag value by tag uuid
* Get blob payload by blob-path
*
* @param tagId tag identifier
* @return tag value
* @throws SQLException when fetching tag value failed
* @param path blob path
* @return byte array of blob
* @throws SQLException when reading payload failed
* @throws IOException when reading blob payload failed
*/
String getTag(UUID tagId) throws SQLException;
byte[] getBlobPayload(String path) throws SQLException, IOException;

/**
* Remove a tag
* Update blob path
*
* @param tagId tag identifier
* @param tag new value of tag
* @param blobId blob identifier
* @param newPath new blob path
* @return true when updated successfully
* @throws SQLException when updating tag failed
* @throws SQLException when updating blob failed
*/
boolean updateTag(UUID tagId, String tag) throws SQLException;
boolean updateBlobPath(UUID blobId, String newPath) throws SQLException;

/**
* Remove a tag
* Update blob payload
*
* @param tagId tag identifier
* @return true when tag deleted successfully
* @throws SQLException when updating tag failed
* @param blobId blob identifier
* @param newPayload new blob payload
* @return true when updated successfully
* @throws SQLException when updating blob failed
*/
boolean removeTag(UUID tagId) throws SQLException;
boolean updateBlobPayload(UUID blobId, InputStream newPayload) throws SQLException;

/**
* Add tag to a blob
* Get blob metadata by blob identifier
*
* @param blobId blob identifier
* @param tagId tag identifier
* @return true when added successfully
* @throws SQLException when assigning tag failed
* @return simplified blob metadata
* @throws SQLException when retrieving blob metadata failed
*/
boolean addTagToBlob(UUID blobId, UUID tagId) throws SQLException;
Blob.SimplifiedMetadata getBlobMetadata(UUID blobId) throws SQLException;

/**
* Remove tag from a blob
* Get blob metadata by blob path
*
* @param blobId blob identifier
* @param tagId tag identifier
* @return true when removed successfully
* @throws SQLException when de-assigning tag failed
* @param path blob path
* @return simplified blob metadata
* @throws SQLException when retrieving blob metadata failed
*/
boolean removeTagFromBlob(UUID blobId, UUID tagId) throws SQLException;
Blob.SimplifiedMetadata getBlobMetadata(String path) throws SQLException;

/**
* Get blob payload
*
* Delete a blob
* @param blobId blob identifier
* @return byte array of blob
* @throws SQLException when reading payload failed
* @throws IOException when reading blob payload failed
* @return true when deleted successfully
* @throws SQLException when blob deletion failed
*/
byte[] getBlobPayload(UUID blobId) throws SQLException, IOException;
boolean deleteBlob(UUID blobId) throws SQLException;

/**
* Add recipient
* Create recipient
*
* @param name name of recipient
* @param metadata optional metadata for user
Expand Down
Loading

0 comments on commit 33568a3

Please sign in to comment.