Appearance
PlatformHub Adapter
An adapter in PlatformHub bridges between the legacy journey or capability libraries and PlatformHub Plugins. Adapters allows the legacy libraries to communicate with PlatformHub Plugins using the PlatformHub messaging system. Legacy libraries provide a contract interface that is implemented by the host app to allow communication with other libraries which is not possible with an app using PlatformHub.
An adapter in itself is just a class that inherits from the Plugin abstract class from PlatformHub library. In the adapter class is where you will be implementing the logic that is normally implemented in the contract for the legacy libraries. This way the host app doesn't need to implement any contract and the legacy library can now use the platform hub messaging to send and receive data from other plugins. However, If there is legacy code that is still dependant on the legacy framework you are adapting, do not close its legacy public interface. Only close it once we know no legacy code is using it so we can only expose the Plugin Protocol public interface to communicate with the adapter plugin.
We use the term Adapter because we are converting an existing library to a PlatformHub Plugin but the implementation of the Adapter follows the same principles as any PlatformHub Plugin.
Types of Adapters
There are two types of adapters that can be implemented.
Standalone Adapter - This is an adapter that is released independently to nexus and can be re-used across multiple apps. This type of adapters are the result of converting legacy libraries that are already released on nexus.
Hybrid Adapter - This is similar to the standalone adapter, except the hybrid adapter is not released independently from the legacy library that is being adopted. The adapter class is added as part of the legacy library codebase and released as part of the legacy library which allow both communication with PlatformHub plugins and other legacy libraries that still depend on the adopted library.
Internal App Adapter - This type of adapter is implemented internally as part of the app and it is only used within the app that implements it. This adapter is for converting libraries that lives inside the app.
Platform Specific Implementation
Please refer to the links below for platform specific implementation of an adapter: