Reuse, Reuse, Reuse its the Developer’s mantra.
You go through all the effort to define in Oracle Mobile Cloud Service a Mobile Backend, specify all the endpoints and methods of your APIs, test all the Connectors and Storage collections to support a mobile application. Then you find out that some of those definitions and components can used in other mobile applications.
Being the good developer you are, you’re more than willing to share those definitions with other service developers to make their job easier. Wouldn’t it be nice to have a way to extract a set of definitions and all the dependent artifacts from one MCS instance and deposit those definitions into another MCS instance?
Well it’s very easy and straightforward if you use the new Export/Import features in MCS. You can export almost any MCS artifact like a Mobile Backend, an API or a Collection.
Let’s say you’re interested in reusing a Mobile Backend and all its components in another mobile application; the export process creates a packaged zip file which would contain a single mobile backend and all its dependent components, including any APIs the backend uses, any implementations the API uses along with any connectors and storage collections the MBE uses.
You invoke the Export wizard, from the More menu on main page of the component you wish to archive.
In the Export page, you see all the dependent components that will be archived, including the state they are in, either Draft or Published.
You may then change any of the Policies the exported environment uses, for example the end points of your connectors. When the export process is complete you have a zip comprised of four files: the export, a package.json with the roles that need to be manually created in the target MCS instance, and policies.json containing all the exported policies and a Readme.txt listing all the exported artifacts.
Importing the packaged archive is even simpler than creating an export. In your target MCS instance, invoke the DEVELOPEMENT menu, expand the Applications menu and select the Import option.
This three step wizard steps you through the process of importing an archived package, viewing the contents of the import and making any last minute policy changes. Once the import completes, the top level components and all its dependent components will be added to the MCS instance.
One important point to make about the import process: you must manually pre-create, in the target MCS environment, any roles used by the artifacts found in the packaged archive.
Image courtesy of potowizard at FreeDigitalPhotos.net