Class DataHubDataFragment

  • All Implemented Interfaces:
    ImpExFragment

    public class DataHubDataFragment
    extends java.lang.Object
    implements ImpExFragment
    A fragment containing data being loaded from the Data Hub
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addLine​(java.lang.String line)
      Adds a line of the script to this block.
      boolean addLine​(java.lang.String line, java.util.List<ImpExFragment> fragments)
      Adds a line of the script to this block.
      java.lang.String getContent()
      Reads back the content of this script block.
      java.io.InputStream getContentAsInputStream()
      Retrieves an input stream to read content of this fragment.
      protected DataHubFacade getDataHubFacade()
      Retrieves facade being used for communication with the Data Hub.
      java.lang.String getHeader​(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.InputStream getImpexBody()  
      java.lang.String getUrl()
      Reads URL specified in this fragment.
      protected void validateImpexHeader​(java.lang.String header, java.lang.String macros)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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: ImpExFragment
        Adds a line of the script to this block.
        Specified by:
        addLine in interface ImpExFragment
        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: ImpExFragment
        Adds a line of the script to this block.
        Specified by:
        addLine in interface ImpExFragment
        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.IOException
        Description copied from interface: ImpExFragment
        Reads back the content of this script block.
        Specified by:
        getContent in interface ImpExFragment
        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.IOException
        Description copied from interface: ImpExFragment
        Retrieves an input stream to read content of this fragment.
        Specified by:
        getContentAsInputStream in interface ImpExFragment
        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.