Unica Content Integration Developer Guide
Total Page:16
File Type:pdf, Size:1020Kb
Unica Content Integration V12.1 Developer Guide Contents Chapter 1. Overview.......................................................................................................... 1 Plugins.................................................................................................................................... 1 Integration support and plugin development approach..................................................... 1 RESTful content search flow........................................................................................ 2 Non-RESTful content search flow................................................................................ 3 Chapter 2. Plugin development overview.......................................................................... 4 Components of plugin...........................................................................................................4 Service declarations.......................................................................................................5 Standard services........................................................................................................ 11 Service implementations.............................................................................................17 Chapter 3. Plugin Development SDK............................................................................... 24 Generic type parameters.................................................................................................... 24 Service invocation............................................................................................................... 27 Execution context................................................................................................................31 User data source......................................................................................................... 33 Standard services and specialized types.......................................................................... 33 Invocation of standard services................................................................................. 34 Specialized types......................................................................................................... 37 Standard exceptions........................................................................................................... 63 RESTful approach........................................................................................................ 63 Functional approach....................................................................................................63 Loggers.................................................................................................................................65 Chapter 4. Setting up the development environment....................................................... 67 Contents | iii Chapter 5. Verification and troubleshooting.................................................................... 79 Overview of loggers............................................................................................................ 80 Useful loggers in log4j2.xml file.................................................................................80 Other important loggers..............................................................................................82 Chapter 1. Overview Unica Content Integration facilitates easy integration with Content Management Systems and enables searching content from them. The fetched content can be used by the client of Unica Content Integration for various content-oriented business use cases. A Unica Content Integration client is any product from Unica Suite which integrates with it to consume the content from the target systems. Plugins To integrate with different CMS, Unica Content Integration uses REST APIs. Since each CMS has a unique programming interface, Unica Content Integration uses custom plugins or modules written specifically for the target CMS. You can implement plugins using Java programming language. Unica Content Integration does not enforce any dependency of any third-party library for developing such plugins. You can customize plugins to utilize any third-party library for its implementation. Plugins can be used to fill in the logical gaps related to the target system. Plugins non-intrusively augment Unica Content Integration to fetch desired content from external content store. Integration support and plugin development approach Unica Content Integration provides out-of-the-box support for easy integration with RESTful interfaces. It also facilitates alternative approach of plugin development to integrate with non-RESTful systems such as database, file systems, or any other content repository. A typical plugin written for REST API integration does not contain any logic to establish connection with the target system, and to handle protocol level success and failure conditions. Such responsibilities are handled by the Content Integration Framework. Plugins provide only system-specific pieces of information, such as: Unica Content Integration V12.1 Developer Guide | 1 - Overview | 2 • absolute location of the target API • HTTP method to be used • headers to be supplied • request body to be sent • type of the response to be expected • transformer for the received response An alternate plugin development approach for non-RESTful integration involves thorough implementation. For example, a plugin written for fetching content from database needs to address everything involved in making DB connection, executing SQLs, closing connections, result set hydration, failure handling etc. Plugins do not initiate the content search. Content Integration Framework first receives the search request, which is delegated to the respective plugin. In case of RESTful integrations, Content Integration Framework initiates the HTTP interaction and gathers the necessary information from the plugin, when required. RESTful content search flow The following figure shows the end-to-end execution flow for RESTful content search: Figure 1. RESTful content search flow When Content Integration Framework receives content search request from user for the target system, it consults with the respective plugin to gather request specific logical Unica Content Integration V12.1 Developer Guide | 1 - Overview | 3 information and makes an API call to the target system. It consults with the plugin once again to transform the API response into an expected format and responds to the user. Non-RESTful content search flow The following figure shows the end-to-end execution flow for Non-RESTful content search: Figure 2. Non-RESTful content search flow Non-RESTful plugins interact with the content repository and provides the search results to Content Integration Framework. Unlike RESTful repositories, Content Integration Framework will not know the type, architecture, protocol and the authentication mechanism used for communicating with the target repository. Chapter 2. Plugin development overview Unica Content Integration facilitates easy integration with new content repositories without having to alter the core Content Integration framework. Unica Content Integration seamlessly integrates with system-specific, independent plugins. Once the plugin is developed and dropped under the <ASSET_PICKER_HOME>/ plugins/custom directory on the application server hosting Content Integration, the corresponding content repository can be onboarded in the Unica product suite by updating a few configurations in Unica Platform. For more information, see Unica Content Integration Administrator's Guide Note: <ASSET_PICKER_HOME> refers to the base installation directory of Unica Content Integration placed within Platform home. Hence, any further use of <ASSET_PICKER_HOME> in this guide should be considered as a path to the Content Integration directory within Platform home. Unica Content Integration is shipped with a development kit containing the dependencies, reference projects, and a starter project to quick start the plugin development. Development kit is placed within the <ASSET_PICKER_HOME>/dev-kits directory. Four reference projects, named aem-integration, wcm-integration, dx-integration, and commerce- integration are available for Adobe Experience Manager (AEM), IBM Web Content Manager (WCM), HCL Digital Experience and HCL Commerce, respectively. Components of plugin A typical plugin contains the following components: • Service declarations (on page 5) • Service implementations (on page 17) The term Service represents a Java class, which either indirectly aids in consuming an external REST service, or directly interacts with external web service(s) or system(s) for a Unica Content Integration V12.1 Developer Guide | 2 - Plugin development overview | 5 designated purpose. External system need not be a standard Content Management System and external services need not belong to any standard CMS. It can be any system or an API. Any service implemented by the plugin must be declared in a centrally managed service declaration file. A service declaration file is an YML configuration file containing the list of services implemented by all the available plugins. The service declaration file must be named custom-plugin-services.yml. It should be available within the <ASSET_PICKER_HOME>/conf directory. Structure of custom-plugin-services.yml file must be similar to the plugin-services.yml file, which exists in the same directory. The plugin-services.yml file contains service