Approach for Writing Custom Implementation for Injectors

injector-sample-impl-23.0.000.jar is provided as reference implementation for injector service however customer can choose to write their own custom implementation logic. Steps listed here will help customer to write their own injector classes.

  1. To start with implementation, create a file with name injectors.xml. This file contains mapping for the injector implementation class, which will be looked for the given family and msgType. InjectorFactory looks for the injectors.xml, this should be present in classpath. Look at injec-tor-sample-impl-23.0.000.jar/retail/injectors.xml for reference.

    Sample Code: For Diffs family and DiffCre message type, injector implementation class is Diffs

    <injector_config>
    <family name="Diffs">
    <injector class="oracle.retail.rib.javaee.api.stubs.injector.file.impl.Diffs">
    <type>DIFFCRE</type>
    </injector>
    <injector class="oracle.retail.rib.javaee.api.stubs.injector.file.impl.Diffs">
    <type>DIFFDEL</type>
    </injector>
    <injector class="oracle.retail.rib.javaee.api.stubs.injector.file.impl.Diffs">
    <type>DIFFMOD</type>
    </injector>
    </family>
    ..
    .
    </injector_config>
    
  2. In the given jar, all the injectors class extends SampleInjector. This is the class where logic for handling the payload will be written. You can write your own implementation class and Diffs can extend that class.

    Sample Code:

    public final class Diffs extends SampleInjector{
    ..
    }
    
  3. Custom Implementation class should implement injector interface (contract for inject method).

    Sample code:

    import oracle.retail.rib.common.exception.RetailBusinessException;
    import oracle.retail.rib.common.exception.RetailSystemException;
    import com.oracle.retail.integration.payload.Payload;
    import com.retek.rib.binding.injector.Injector;
    public class SampleInjector implements Injector {
     
     
    // dummy impl for Injector
    public void inject(String type, Payload payload)
    throws RetailBusinessException, RetailSystemException {
    // Write logic here
    System.out.println("Inject executed successfully...");
    LOG.info("Inject executed successfully...");
    }
    }
    
  4. Copy custom implementation jar in-side <tomcat-apache>\webapps\rib-injector-services-web\WEB-INF\lib for it to work.