Creating an adapter project
This topic describes how to create an adapter project for a pre or post processor or a custom authenticator.
These steps are applicable up to version 6.3.0.
Creating an adapter project for pre or post processor
Procedure
-
Run the
create-adapterscript to create the adapter project.-
Linux or macOS:
/home/user/MasheryLocalSDK$ ./create-adapter.sh --project-name MyCustomAdapter --adapter-type TrafficEventListener --adapter-name MyCustomProcessor --package-name com.companyname.apim.adapter -
Windows:
C:\Users\Administrator\MasheryLocalSDK> create-adapter.bat --project-name MyCustomAdapter --adapter-type TrafficEventListener --adapter-name MyCustomProcessor --package-name com.companyname.apim.adapter
-
-
Change the project name, adapter name, and package name to match your project.
noteThe first run of the script downloads the required Gradle binaries.
-
Open the Java source
MyCustomProcessor.javain a text editor and write the pre-processing and post-processing logic. -
Run the
migrate-adapterscript to scan the project for OSGi-specific code and add the@AutoServicediscovery annotation:-
Linux or macOS:
/home/user/MasheryLocalSDK$ chmod +x migrate-adapter.sh
/home/user/MasheryLocalSDK$ ./migrate-adapter.sh -p MyCustomAdapter -
Windows:
C:\Users\Administrator\MasheryLocalSDK> migrate-adapter.bat -p MyCustomAdapter
-
Creating an adapter project for custom authenticator
Procedure
-
Run the
create-adapterscript to create the adapter project.-
Linux or macOS:
/home/user/MasheryLocalSDK$ ./create-adapter.sh --project-name MyCustomAdapter --adapter-type Authenticator --adapter-name MyCustomAuthenticator --package-name com.companyname.apim.adapter -
Windows:
C:\Users\Administrator\MasheryLocalSDK> create-adapter.bat --project-name MyCustomAdapter --adapter-type Authenticator --adapter-name MyCustomAuthenticator --package-name com.companyname.apim.adapter
-
-
Change the project name, adapter name, and package name to match your project.
noteThe first run of the script downloads the required Gradle binaries.
-
Open the Java source
MyCustomAuthenticator.javain a text editor and implement the authenticator logic.For information about editing in an IDE, refer to Using the Adapter SDK in an IDE.
For adapter examples, refer to Pre-processing Stages and Post-processing Stages.
-
Run the
migrate-adapterscript to scan the project for OSGi-specific code and add the@AutoServicediscovery annotation:-
Linux or macOS:
/home/user/MasheryLocalSDK$ chmod +x migrate-adapter.sh
/home/user/MasheryLocalSDK$ ./migrate-adapter.sh -p MyCustomAdapter -
Windows:
C:\Users\Administrator\MasheryLocalSDK> migrate-adapter.bat -p MyCustomAdapter
-