Class DataHubImpExResourceFactory

java.lang.Object
com.hybris.datahub.core.services.impl.DataHubImpExResourceFactory
All Implemented Interfaces:
ImpExResourceFactory

public class DataHubImpExResourceFactory extends Object implements ImpExResourceFactory
An implementation of the ImpEx resource factory for creating Data Hub specific impex resources.
  • Constructor Details

    • DataHubImpExResourceFactory

      public DataHubImpExResourceFactory()
  • Method Details

    • createResource

      public ImpExResource createResource(ItemImportTaskData ctx) throws ImpExException
      Description copied from interface: ImpExResourceFactory
      Creates an import resource for the specified import context.
      Specified by:
      createResource in interface ImpExResourceFactory
      Parameters:
      ctx - context of the import task, which contains content to import and any information relevant to the import process.
      Returns:
      a resource to load into the system.
      Throws:
      ImpExException - if the context does not contain a valid ImpEx script.
    • createScriptStream

      protected InputStream createScriptStream(ItemImportTaskData ctx) throws ImpExException
      Creates an input stream to read the final ImpEx script content, which includes the data, because the original script does not contain actual data.
      Throws:
      ImpExException - if the script is invalid or reading failed.
    • extractFragments

      protected List<ImpExFragment> extractFragments(ItemImportTaskData ctx) throws ImpExException
      Reads ImpEx script from the input stream and splits it into the logical fragments based on the script content.
      Parameters:
      ctx - a data object containing ImpEx data and errors
      Returns:
      a fragments of the script in the same order as they appear in the script or an empty list, if there is nothing in the input stream
      Throws:
      ImpExException - if the script is invalid or reading failed.
    • getFragmentReader

      protected FragmentReader getFragmentReader()
      Retrieves the fragment reader to be used by this factory for reading the ImpEx script.
      Returns:
      a reader to be used.
    • setFragmentReader

      public void setFragmentReader(FragmentReader r)
      Specifies a reader to use for reading the ImpEx script.
      Parameters:
      r - a reader to use.