Example Implementation

The following example shows a custom ExportWriter implementation based on com.escenic.syndication.xml.AbstractExportWriter. It is an extremely simplified example that just sends the generated XML to a specified URI:

package com.my.company.syndication;

import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;

import neo.xredsys.api.IOObject;

public class MyExportWriter extends AbstractExportWriter {

  public MyExportWriter() {
    //By design
  }

  @Override
  protected OutputStream getOutputStream(final IOObject pObject, final URI pBaseURI) throws IOException {
    URLConnection connection = pBaseURI.toURL().openConnection();
    connection.setDoOutput(true);
    return connection.getOutputStream();
  }
}

To be able to use this ExportWriter implementation you would need to:

  1. Create a configuration file for your component. This file must be added to one of your configuration layers, in the location configuration-root/com/my/company/syndication/MyExportWriter.properties. It must contain at least the following line:

    $class=com.my.company.syndication.MyExportWriter

    For more information about configuration layers, see Configuring The Content Engine.

  2. Create an export task configuration file (see Export Task Configuration Files) in which the exportWriter property is set to point to your ExportWriter implementation's configuration file. For example:

    exportWriter=/com/my/company/syndication/MyExportWriter

You can find further information in the ExportWriter interface's JavaDoc.