Class DataHubDataFragment
- java.lang.Object
-
- com.hybris.datahub.core.services.impl.DataHubDataFragment
-
- All Implemented Interfaces:
ImpExFragment
public class DataHubDataFragment extends java.lang.Object implements ImpExFragment
A fragment containing data being loaded from the Data Hub
-
-
Constructor Summary
Constructors Constructor Description DataHubDataFragment(DataHubFacade daHub)Instantiates this fragment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddLine(java.lang.String line)Adds a line of the script to this block.booleanaddLine(java.lang.String line, java.util.List<ImpExFragment> fragments)Adds a line of the script to this block.java.lang.StringgetContent()Reads back the content of this script block.java.io.InputStreamgetContentAsInputStream()Retrieves an input stream to read content of this fragment.protected DataHubFacadegetDataHubFacade()Retrieves facade being used for communication with the Data Hub.java.lang.StringgetHeader(java.lang.String header)Reads value of a specific header defined in this fragment.java.util.Map<java.lang.String,java.lang.String>getHeaders()Reads headers present in this fragment.protected java.io.InputStreamgetImpexBody()java.lang.StringgetUrl()Reads URL specified in this fragment.protected voidvalidateImpexHeader(java.lang.String header, java.lang.String macros)
-
-
-
Constructor Detail
-
DataHubDataFragment
public DataHubDataFragment(DataHubFacade daHub)
Instantiates this fragment.- Parameters:
daHub- implementation of the facade for communicating to the Data Hub.
-
-
Method Detail
-
addLine
public boolean addLine(java.lang.String line)
Description copied from interface:ImpExFragmentAdds a line of the script to this block.- Specified by:
addLinein interfaceImpExFragment- Parameters:
line- a line of script text- Returns:
true, if the line is added;false, if the line does not belong to this block.
-
addLine
public boolean addLine(java.lang.String line, java.util.List<ImpExFragment> fragments)Description copied from interface:ImpExFragmentAdds a line of the script to this block.- Specified by:
addLinein interfaceImpExFragment- Parameters:
line- a line of script text- Returns:
true, if the line is added;false, if the line does not belong to this block.
-
validateImpexHeader
protected void validateImpexHeader(java.lang.String header, java.lang.String macros) throws ImpExException- Throws:
ImpExException
-
getImpexBody
protected java.io.InputStream getImpexBody() throws java.io.IOException- Throws:
java.io.IOException
-
getContent
public java.lang.String getContent() throws java.io.IOExceptionDescription copied from interface:ImpExFragmentReads back the content of this script block.- Specified by:
getContentin interfaceImpExFragment- Returns:
- content of this script block or an empty string, if this block is empty.
- Throws:
java.io.IOException- if failed to read this fragment content.
-
getContentAsInputStream
public java.io.InputStream getContentAsInputStream() throws java.io.IOExceptionDescription copied from interface:ImpExFragmentRetrieves an input stream to read content of this fragment.- Specified by:
getContentAsInputStreamin interfaceImpExFragment- Returns:
- an input stream to read content of this fragment.
- Throws:
java.io.IOException- if failed to create an input stream for the fragment content.
-
getDataHubFacade
protected DataHubFacade getDataHubFacade()
Retrieves facade being used for communication with the Data Hub.- Returns:
- facade implementation.
-
getUrl
public java.lang.String getUrl()
Reads URL specified in this fragment.- Returns:
- the URL to read data from.
-
getHeaders
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Reads headers present in this fragment.- Returns:
- a map of the HTTP headers to pass to the Integration Layer; an empty map, if no headers defined in this fragment.
-
getHeader
public java.lang.String getHeader(java.lang.String header)
Reads value of a specific header defined in this fragment.- Parameters:
header- name of the header to read.- Returns:
- value of the specified header or
null, if the specified header is not defined in this fragment.
-
-