Exiv2 and Cloud Services

1. Introduction

This article is to share my investigations about some of cloud services and suggest the way to integrate them into Exiv2. The investigated cloud services are Google Drive and Dropbox, which are the most popular services. As enterprises integrate their existing IT infrastructures and IT resources with the sharable cloud paradigm, it is imperative for cloud enablers to provide a uniform API that these enterprises can use to tailor the cloud to their business processes. Hence, the way we integrate Google Drive and Dropbox into Exiv2 should be applicable to other cloud services.

2. Architecture

Most of cloud services provide Representational State Transfer (RESTful) API to allow users to perform the operations (view, edit, delete, share, …) on their resources.
The API is mostly based on the HTTP/HTTPS protocol and GET, POST, PUT, and DELETE requests may be all used. The API presupposes no particular structure in the Uniform Resource Identifier (URI) space. The starting point is a URI, supplied by the cloud service provider, that identifies the cloud itself. The cloud's representation contains URIs for the other resources in the cloud. Operations on the cloud resources are performed by making an HTTP request against the URI of the resource.
Before accessing the API, the applications are required to ask users to authenticate as well as authorize the permission to access the user data. Most of the cloud services use OAuth 2.0 to do that.

The following is the way we should integrate the cloud services to Exiv2.

Fig.1. The domain diagram of CloudIo

The CloudIo should contains 2 components: Exiv2::Oauth and Exiv2::CurlIo.
  • The Exiv2:Oauth is to request and receive credentials to access the API. The credentials in this case are often the tokens. The tokens are attached to the request headers that are sent to RESTFUL API to get the data.
  • The Exiv2::CurlIo is to retrieve the data. It should be similar as we access a particular image URL because the API is mostly based on the HTTP/HTTPS protocol (We should easily get byte-ranges and PUT byte-ranges)

Fig.2. the flow of CloudIo

Note: the above diagram indicates briefly the flow of CloudIo. It should be much more complicated in details. The step 1 & 2 should contain more sub-steps before the token is returned (e.g. the step when user provides username, password).

3. Google Drive

The documentation of Google Drive (https://developers.google.com/drive/) is very clear and detail. I don’t intend to repeat it at here. I just want to highlight some key points.

4. Dropbox API

The RESTFUL API of dropbox is at https://www.dropbox.com/developers/core/docs It’s very clear and detail. It’s very similar as Google Drive and it's all done with fairly normal HTTP GETs, POSTs, PUTs.

Dropbox also uses Oauth 2.0

ClassDiagram.jpg (54.2 KB) Tuan Nhu, 19 Aug 2013 06:50

requestflow.jpg (92.9 KB) Tuan Nhu, 19 Aug 2013 06:55

Redmine Appliance - Powered by TurnKey Linux