Seasoned developers know that even trivial requirements can cause major headaches, especially when new platforms such as mobile are being introduced into an established enterprise landscape. Take the small but common requirement in a mobile app of sharing pictures or files between mobile users. With on-premises enterprise solutions, architects might suggest provisioning a centralized file server to share the content, building REST APIs, and much more. The Oracle Mobile Cloud Service out-of-the-box Storage API simplifies the solution for this requirement. The Storage API enables mobile developers to store text and binary files in the cloud without having to build out and maintain substantial on-premises infrastructure.
To follow the steps in this article, you first must obtain an Oracle Mobile Cloud Service trial account. Click Try It, and then follow the prompts to create your trial account. You’ll receive a confirmation email with details about how to access your Oracle Cloud account and activate your Oracle Mobile Cloud Service instance. Follow the linked documentation to complete your sign-up and activate and access Oracle Mobile Cloud Service.Create a Test Role and Two Test Users
Given this article’s goal of exploring storage that enables mobile users to share some content and to protect other content in their own collections, it’s necessary to set up a test role and two mobile users to demonstrate these respective functions. The instructions start from the Oracle Mobile Cloud Service portal.
With the test role and users ready, you can now create the other Oracle Mobile Cloud Service design-time artifacts to test the storage.Create a Mobile Back End
For each mobile application you want to provide with storage capability through Oracle Mobile Cloud Service, you must define a mobile back end to expose the storage to the mobile app. The mobile back end acts as the gatekeeper to which services each application and its mobile users can access.
With the mobile back end created, you can now set up the two different types of storage collections. First you’ll create the collection for storing files shared among all mobile users of an app, and then you’ll set up an isolated collection to protect and isolate files in a personal collection for each user of the mobile app.
At this point, you’ve set up all the design-time artifacts needed to demonstrate the storage collection’s capabilities, so you can next explore the storage API’s runtime behavior and its supported REST APIs.Understanding the Storage REST APIs
The Oracle Mobile Cloud Service Storage API is built around a set of REST endpoints based on the collections you’ve already defined and their objects. Externally, your mobile applications and their predefined mobile users interact with the collections and objects through the REST endpoints, using the usual set of HTTP verbs: GET, PUT, POST, DELETE, and so on.
The Oracle Mobile Cloud Service user interface provides a built-in test facility that mobile developers can use to examine and test the REST endpoints and their functionality without building a complete mobile application. First watch this video to learn how you can explore the collections.
Now take a look at a second video that demonstrates working with objects in the collections. You’ll see how objects can be shared among mobile users via the OraMagSharedCollection and how objects stored in the OraMagIsolatedCollection are accessible only by the owning user.
As you learned from the videos, a shared collection has a single instance that is shared by all mobile users who have privileges for that collection. So any objects uploaded to that single shared collection are immediately visible to all such users. On the other hand, for an isolated collection, an instance of the isolated collection is created for each mobile user who has privileges for the isolated collection. And any objects uploaded by a user remain in that user’s isolated collection and are secure, preventing other mobile users from seeing and accessing those files.Conclusion
This article introduced the lightweight Storage API provided by Oracle Mobile Cloud Service and demonstrated its two primary use cases: providing file sharing for your app’s mobile users (using a shared collection) and providing private storage for individual mobile users (using an isolated collection). Oracle Mobile Cloud Service provides this storage mechanism so mobile developers can easily add off-device file storage without provisioning that storage on existing enterprise on-premises infrastructure. Oracle Mobile Cloud Service developers who want heavyweight storage—that is, storage that’s supported by the full power of SQL—should look into the Oracle Mobile Cloud Service Database API.
READ more about Oracle Mobile Cloud Service.
JOIN the Oracle Mobile Platform Google+ community.
Photography by Raw Pixel, Unsplash