Scenario: Overriding Building Block Services


Based on
the requirements, you can override/replace a building block service using
your own implementation of the service. 

Implementation overview

To add a custom service, add the custom implementation for the building block service in the CorrespondenceManagementSolutionTemplate/Services project. Implement the existing service interface while providing a custom implementation for the service. For example, to provide custom implementation for CategoryService, implement the "com.adobe.icc.services.api.CategoryService" interface.
  1. Add the following bean entry to the CorrespondenceManagementSolutionTemplate\Services\resources\META-INF\spring\cm\adobe-cm-spring-config.xml file:
    <bean id="customCategoryService" class="com.adobe.icc.CustomCategoryServiceImpl" />
    Note: These are sample configurations assuming that the fully classified name of the custom implementation class is "com.adobe.icc.CustomCategoryServiceImpl".
  2. Add the following entry to the <bp:blueprint> section of CorrespondenceManagementSolutionTemplate\Services\resources\META-INF\spring\osgi-context.xml file:

    <bp:service interface="com.adobe.icc.services.api.CategoryService" ranking="10" ref="customCategoryService"> 
           <bp:service-properties> 
                   <entry key="connectors.httpinvoker" value="true" /> 
                   <entry key="connectors.httpinvoker.alias" value="/lc.icc.dbservices.categoryService" /> 
            </bp:service-properties> 
    </bp:service>
    Note: This configuration exposes the custom category service with the higher rank than the original category service. The two service properties also override the category service exposed on the http endpoint with the custom category service.
  3. Create an XML file at the location CorrespondenceManagementSolutionTemplate\package-resources\etc\aep\config\dataservices\destinations\remoting to expose the updated remoting destination with the following information:

    <destination id="lc.icc.dbservices.categoryService"> 
           <properties> 
                <factory>osgi</factory> 
                <scope>application</scope> 
                <source>com.adobe.icc.services.api.CategoryService</source> 
           </properties> 
    </destination>
    Note: This configuration overrides the category service exposed on the remoting endpoint with the custom category service. This step is important because the Flex code is already written and is tied to the remoting id of the original service. To replace it, make the custom service with higher rank available with the same remoting id.
  4. Rebuild and redeploy the Solution template to view the changes. For information on rebuilding and redeploying, see Building and deploying the Solution Template

// Ethnio survey code removed