Class DataHubImpExResourceFactory
- java.lang.Object
-
- com.hybris.datahub.core.services.impl.DataHubImpExResourceFactory
-
- All Implemented Interfaces:
ImpExResourceFactory
public class DataHubImpExResourceFactory extends java.lang.Object implements ImpExResourceFactory
An implementation of the ImpEx resource factory for creating Data Hub specific impex resources.
-
-
Constructor Summary
Constructors Constructor Description DataHubImpExResourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImpExResourcecreateResource(ItemImportTaskData ctx)Creates an import resource for the specified import context.protected java.io.InputStreamcreateScriptStream(ItemImportTaskData ctx)Creates an input stream to read the final ImpEx script content, which includes the data, because the original script does not contain actual data.protected java.util.List<ImpExFragment>extractFragments(ItemImportTaskData ctx)Reads ImpEx script from the input stream and splits it into the logical fragments based on the script content.protected FragmentReadergetFragmentReader()Retrieves the fragment reader to be used by this factory for reading the ImpEx script.voidsetFragmentReader(FragmentReader r)Specifies a reader to use for reading the ImpEx script.
-
-
-
Method Detail
-
createResource
public ImpExResource createResource(ItemImportTaskData ctx) throws ImpExException
Description copied from interface:ImpExResourceFactoryCreates an import resource for the specified import context.- Specified by:
createResourcein interfaceImpExResourceFactory- 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 java.io.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 java.util.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.
-
-