Oracle ADF with Google Cloud Storage

Source: 1) GoogleLib 2) Application

This would be the third, final and the shortest article on the topic of integrating ADF Faces with Google's NoSQL Firebase database. In my previous two articles - Oracle ADF with Google Firebase and Oracle ADF with Google Firebase (Part II - Secure CRUD) - I have spoken about setting up Firebase database reference and performing secure CRUD operations. I have used Firebase Admin setup for Java for all of my activities.

This article explores another great feature in this package - Google Cloud Storage. Unfortunately, the Admin SDK is quite limited when it comes to storage. Almost all the great features have been exposed to the Android SDK or the web/JavaScript SDK libraries. But nonetheless, with whatever is available, we can store documents on the Firebase cloud storage and access them via a secured protocol.

To set up cloud storage, we need to extend our Firebase initialization to include the default cloud storage bucket - gs:// (without the gs://).

Once the Firebase is initialized with its default bucket, we would be able to get a handle of the StorageClient object, which would provide us with the necessary tools to upload our documents. A document is converted to a object, which is then uploaded to the storage bucket. Folder structures can be included while generating the blob information, and the document is stored accordingly.

If we print the BlobId, BlobInfo and Blob objects, we would get some useful information:

Now that we have stored the object, it is time to fetch it. Again, firebase admin is not quite the most effective API to do that. But we do have some useful tools. One secured way to do this is to let firebase create a signed URL. This URL would live for some time (you can specify its longevity).

I have chosen one hour, since this is right about the time your ADF session gets cleaned out.

This String download-path can be used as the source for an af:image component on your UI. The URL is signed with a token, which lives for one hour and is generated from the service-account JSON file.

That concludes this topic for now. The sample application and the related libraries can be downloaded from the GitHub repositories mentioned at the beginning (clone them under one root folder). The GoogleLib project can be built into a war file and deployed to WebLogic as a shared library. This library can be referenced as "google-shared-lib" from your application via weblogic.xml.

All you need is a Google account to create a new project on the firebase console. Download the service account key from its settings and mention its full path on the GoogleHrModuleImpl PRIVATE_KEY value. Modify the names of the firebase store according to the name of your project.



  1. ADF seems to be good, why Oracle is not promoting that framework?

    1. Well I can't comment much on promotion, but Oracle is certainly continuing to invest on ADF.

      Check out Andrejus' post from Open World '18 on ADF 19:


Post a Comment