Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 ML has a set of input/output adapters that are used to read/write data. You can extend WSO2 ML input/output adapters using a fragment bundle of org.wso2.carbon.ml.core bundle as explained below. For a sample custom adapter extension implementation, see ML Custom Adapter Extension.

  1. Create a Maven project.
  2. Copy the content in the pom.xml file of the Git sample to the pom.xml file of your project.
  3. Change the values of the <groupId> and <artifactId> properties in the pom.xml file as preferred.
  4. Create a Java class in your project which implements the MLInputAdapter interface, by adding the content in the CustomMLInputAdapter.java file.

    Note

    You need to create a Java class in your project which implements the MLOutputAdapter interface for custom output adapter extensions.

  5. Override the read(String path) Java method with your custom input adapter implementation.

    Note

    You need to override the write(String outPath, InputStream in) Java method for custom output adapter implementations.

  6. Build the bundle by executing the following command: mvn clean install
  7. Copy the built bundle to the <ML_HOME>/repository/components/dropins/ directory.
  8. Add a new property element with a preferred name to the <ML_HOME>/repository/conf/machine-learner.xml file corresponding to your new adapter as shown in the example below.

    Note

    The property name for input/output adapters must end with the ".in" and ".out" suffixes accordingly.

    Code Block
    languagexml
    <Property name="custom.in" value="org.wso2.carbon.ml.custom.adapter.input.CustomMLInputAdapter"/>