Package wt.util

Class CustomIntegrationHelper

java.lang.Object
wt.util.CustomIntegrationHelper
All Implemented Interfaces:
wt.util.IntegrationHelperIfc

public class CustomIntegrationHelper extends Object
Helper class to retrieve configured connection information for external HTTP/HTTPs endpoints.

Example Usage:

 CustomIntegrationHelper customIntegrationHelper = new CustomIntegrationHelper("erp-dev");
 // get absolute url associated with "materialapi" URL fragment for erp-dev system
 customIntegrationHelper.getNamedEndpoint("materialapi");
 // get a map of saved secret pairs for erp-dev system
 customIntegrationHelper.getSecretsMap();
 // get an SSLContent object required for establishing HTTPS connections with erp-dev system
 customIntegrationHelper.getSSLContext();
 



Supported API: true

Extendable: false
  • Constructor Details

    • CustomIntegrationHelper

      public CustomIntegrationHelper(@Nonnull String connectionName)
      Constructor for this class

      Accepts the connection name as a parameter for which we need to fetch the configured connection information

      Supported API: true

      Parameters:
      connectionName - the name of connection/endpoint for which we need to fetch the configured connection information.
  • Method Details

    • getBaseURI

      public URI getBaseURI()
      Gets the base URI for the specified connection name

      Supported API: true
      Parameters:
      endpointName - the endpoint name for which we want to get the base URI
      Returns:
      the base URI for the endpoint associated with this endpoint name
    • getSecretsMap

      public Map<String,String> getSecretsMap() throws KeyStoreException
      Returns a map of unencrypted key value pairs of stored secrets for this endpoint



      Supported API: true

      Specified by:
      getSecretsMap in interface wt.util.IntegrationHelperIfc
      Returns:
      A map of unencrypted key value pairs of secrets
      Throws:
      KeyStoreException
    • getDefaultPayloadHttpMethod

      public String getDefaultPayloadHttpMethod() throws IOException
      Fetches the default HTTP method to be used for payload delivery from extConnections.properties.

      Supported API: true

      Returns:
      Default payload HTTP method
      Throws:
      IOException
    • getHeadersMap

      public Map<String,String> getHeadersMap() throws KeyStoreException, IOException
      Returns a map of header key value pairs for this endpoint



      Supported API: true

      Returns:
      A map of header key value pairs
      Throws:
      KeyStoreException
      IOException
    • getInitializedSSLContext

      Gets an initialized SSLContext object required for establishing HTTPS connection

      The SSLContext will be already initialized using KeyManagerFactories and TrustManagerFactories based on client certificate and/or server certificate provided to PTC.

      Supported API: true

      Specified by:
      getInitializedSSLContext in interface wt.util.IntegrationHelperIfc
      Returns:
      Initialized SSLContext object which can be used to make HTTPS connections to this endpoint
      Throws:
      NoSuchAlgorithmException
      KeyStoreException
      UnrecoverableKeyException
      KeyManagementException
    • getNamedEndpointURI

      public URI getNamedEndpointURI(String endpointName) throws Exception
      Gets the String representation of URI for the specified connection name

      If the baseurl is provided, the return value will be automatically prefixed with the baseurl.

      Example: If the baseurl provided is https://www.dummy.com and URL fragments provided are:

      • /material
      • /inventory
      getNamedEndpointURI("material") will return https://www.dummy.com/material and
      getNamedEndpointURI("inventory") will return https://www.dummy.com/inventory



      Supported API: true

      Specified by:
      getNamedEndpointURI in interface wt.util.IntegrationHelperIfc
      Parameters:
      endpointName - the endpoint name for which we want to get the String URI
      Returns:
      the String URI for the endpoint associated with this endpoint name
      Throws:
      Exception