Class DataHubImpExResourceFactory
java.lang.Object
com.hybris.datahub.core.services.impl.DataHubImpExResourceFactory
- All Implemented Interfaces:
ImpExResourceFactory
An implementation of the ImpEx resource factory for creating Data Hub specific impex resources.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates an import resource for the specified import context.protected InputStreamCreates an input stream to read the final ImpEx script content, which includes the data, because the original script does not contain actual data.protected List<ImpExFragment>Reads ImpEx script from the input stream and splits it into the logical fragments based on the script content.protected FragmentReaderRetrieves the fragment reader to be used by this factory for reading the ImpEx script.voidSpecifies a reader to use for reading the ImpEx script.
-
Constructor Details
-
DataHubImpExResourceFactory
public DataHubImpExResourceFactory()
-
-
Method Details
-
createResource
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
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
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
Retrieves the fragment reader to be used by this factory for reading the ImpEx script.- Returns:
- a reader to be used.
-
setFragmentReader
Specifies a reader to use for reading the ImpEx script.- Parameters:
r- a reader to use.
-