psdi.iface.app.swcatalog.http

Class ImportClient

  • java.lang.Object
    • psdi.iface.app.swcatalog.http.ImportClient


  • public final class ImportClient
    extends java.lang.Object
    ImportClient handles sending Requests to the SwKBT server and interpreting the Responses.
    Since:
    7.2
    • Constructor Summary

      Constructors 
      Constructor and Description
      ImportClient(java.lang.String urlSpec)
      ImportClient Constructor
      ImportClient(java.lang.String host, int port)
      ImportClient Constructor URL created will be in the form https://host:port/ibm/SwKBT/
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getBaseUrl()
      Method to get the baseUrl.
      void getCanonical(java.lang.String filename, java.lang.String sourceDir)
      Get the SwKBT export file.
      java.lang.String getGUID()
      Sends a file scheduling request to SwKBT to get the GUID.
      java.lang.String getStatus(java.lang.String guid)
      Sends a status request to SwKBT for the given request GUID.
      java.lang.String getURLEncodedString(java.util.Map requestProps)
      Returns a URL-encoded string of the given request properties
      void logProperties(java.util.Properties props) 
      void pollStatus(java.lang.String guid, int seconds, int timeout)
      Periodically sends requests for status from the SWKBT server.
      java.io.InputStream send(java.lang.String url)
      Send the requested data to the SwKBT server
      java.io.InputStream send(java.lang.String url2, java.lang.String url1)
      Send the requested data to the SwKBT server
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImportClient

        public ImportClient(java.lang.String urlSpec)
                     throws java.lang.IllegalArgumentException
        ImportClient Constructor
        Parameters:
        urlSpec - URL identifier (ie., protocol://host:port/uri throws IllegalArgumentException if urlSpec is null throws MalformedURLException if a URL cannot be created from input paramters
        Throws:
        java.lang.IllegalArgumentException
      • ImportClient

        public ImportClient(java.lang.String host,
                            int port)
                     throws java.lang.IllegalArgumentException
        ImportClient Constructor URL created will be in the form https://host:port/ibm/SwKBT/
        Parameters:
        host - hostname of the server to connect to
        port - port number
        Throws:
        java.lang.IllegalArgumentException
    • Method Detail

      • getURLEncodedString

        public java.lang.String getURLEncodedString(java.util.Map requestProps)
                                             throws MXSystemException
        Returns a URL-encoded string of the given request properties
        Parameters:
        requestProps - the Map containing the request properties
        Returns:
        URL-encoded string of the given request properties
        Throws:
        MXSystemException
      • getGUID

        public java.lang.String getGUID()
                                 throws MXSystemException
        Sends a file scheduling request to SwKBT to get the GUID.
        Returns:
        String Request GUID as returned from SwKBT
        Throws:
        MXSystemException
      • getStatus

        public java.lang.String getStatus(java.lang.String guid)
                                   throws MXSystemException
        Sends a status request to SwKBT for the given request GUID.
        Parameters:
        guid - Request token gotten from scheduleCanonical
        Throws:
        java.lang.Exception
        java.lang.IllegalArgumentException - if fileName is null or doesn't point to a file
        MXSystemException - if there were errors during import processing
      • logProperties

        public void logProperties(java.util.Properties props)
      • pollStatus

        public void pollStatus(java.lang.String guid,
                               int seconds,
                               int timeout)
                        throws MXSystemException
        Periodically sends requests for status from the SWKBT server.
        Parameters:
        guid - Guid returned from getCanonical
        seconds - Seconds between retries
        timeout - Total number of retries
        Throws:
        MXSystemException - for errors during polling
      • getCanonical

        public void getCanonical(java.lang.String filename,
                                 java.lang.String sourceDir)
                          throws MXSystemException
        Get the SwKBT export file.
        Parameters:
        guid - Request token from scheduleCanonical
        filename - Filename to use. Zip file will be saved with this name & .zip
        sourceDir - Directory to save the file in
        Throws:
        MXSystemException
      • send

        public java.io.InputStream send(java.lang.String url)
                                 throws MXSystemException
        Send the requested data to the SwKBT server
        Parameters:
        uri - the URI to post data
        requestProps - the Map containing the request properties
        headers - the HTTP headers
        Throws:
        MXSystemException
      • send

        public java.io.InputStream send(java.lang.String url2,
                                        java.lang.String url1)
                                 throws MXSystemException
        Send the requested data to the SwKBT server
        Parameters:
        url2 - the URI to post data for canonical 2.0
        url1 - the URI to post data for canonical 1.0
        requestProps - the Map containing the request properties
        headers - the HTTP headers
        Throws:
        MXSystemException
      • getBaseUrl

        public java.lang.String getBaseUrl()
        Method to get the baseUrl.
        Since:
        7.2