Class PortalClient

java.lang.Object
com.webmethods.caf.portalclient.PortalClient

public class PortalClient extends Object
The singleton factory that creates PortalClientContext connections to invoke web services against a specific MWS. It also maintains a default PortletClientContext singleton and a set of static methods to facilitate web service calls with that session. Before use, either call initialize() to configure the default single instance of PortlClientContext or retrieve a new PortalClientContext via getClientContext().
  • Field Details

    • PORTAL_CLIENT_MOD

      public static final String PORTAL_CLIENT_MOD
      Logging module for this component
    • INPROC_FACTORY_ID

      protected static final String INPROC_FACTORY_ID
      See Also:
    • m_portalClientMap

      protected static Map<Class<?>,com.webmethods.caf.portalclient.impl.PortalClientAPI> m_portalClientMap
    • m_init

      protected static boolean m_init
    • m_defaultContext

      protected static PortalClientContext m_defaultContext
    • m_inprocFactoriesRegistered

      protected static boolean m_inprocFactoriesRegistered
  • Constructor Details

    • PortalClient

      public PortalClient()
  • Method Details

    • initialize

      public static void initialize(String portalServerURL)
      Initialize the default PortalClientContext with the URL of the MWS server to call
      Parameters:
      portalServerURL - the fully qualified URL of the MWS runtime (e.g. http://localhost:8585)
    • initialize

      public static void initialize(String portalServerURL, AuthCredentials authCred)
      Initialize the default PortalClientContext with the frontend URL of the MWS server to invoke and the login credentials to authenticate with
      Parameters:
      portalServerURL - the fully qualified URL of the MWS runtime (e.g. http://localhost:8585)
      authCred - the AuthCredentials to authenticate to MWS with
    • initialize

      public static void initialize(String portalServerURL, AuthCredentials authCred, boolean doInprocCheck)
      Initialize the default PortalClientContext with the frontend URL of the MWS server to invoke, the login credentials use to authenticate, and whether to bypass the optimization check if the PortalClient instance is running within the MWS runtime
      Parameters:
      portalServerURL - the fully qualified URL of the MWS runtime (e.g. http://localhost:8585)
      authCred - the AuthCredentials to authenticate to MWS with
      doInprocCheck - true to check if running within the target MWS runtime process and run in optimized "in-proc" mode
    • isInitialized

      public static boolean isInitialized()
      Determine if the default PortalClientContext has been initialized
      Returns:
      true if initialized, otherwise false
    • getClientContext

      public static PortalClientContext getClientContext(String portalServerURL, AuthCredentials authCred)
      Get an initialize a PortalClientContext used to invoke MWS runtime services
      Parameters:
      portalServerURL - the fully qualified URL of the MWS runtime (e.g. http://localhost:8585)
      authCred - the AuthCredentials to authenticate to MWS with
      Returns:
      an initialized PortalClientContext
    • getClientContext

      public static PortalClientContext getClientContext(String portalServerURL, AuthCredentials authCred, boolean doInprocCheck)
      Get an initialize a PortalClientContext used to invoke MWS runtime services
      Parameters:
      portalServerURL - the fully qualified URL of the MWS runtime (e.g. http://localhost:8585)
      authCred - the AuthCredentials to authenticate to MWS with
      doInprocCheck - true to check if running within the target MWS runtime process and run in optimized "in-proc" mode
      Returns:
      an initialized PortalClientContext
    • registerInProcFactories

      protected static void registerInProcFactories()
    • createAlias

      public static URI createAlias(String alias)
      Static helper to create a new URI that represents an MWS alias
      Parameters:
      alias - the alias to create a URI for
      Returns:
      a URI referencing the alias
    • getIdirectorySystemPortType

      public static IdirectorySystemPortType getIdirectorySystemPortType(AuthCredentials authCredentials) throws WSClientException
      Get the idirectorySystemPortType interface for invoking MWS system web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIdirectoryServicePortType

      public static IdirectoryServicePortType getIdirectoryServicePortType(AuthCredentials authCredentials) throws WSClientException
      Get the IdirectoryServicePortType interface for invoking directory web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIprincipalPortType

      public static IprincipalPortType getIprincipalPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IprincipalPortType interface for invoking principal web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIprincipalAttributePortType

      public static IprincipalAttributePortType getIprincipalAttributePortType(AuthCredentials authCredentials) throws WSClientException
      Get the IprincipalAttributePortType interface for invoking principal attribute web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIuserPortType

      public static IuserPortType getIuserPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IuserPortType interface for invoking user web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIaccessPortType

      public static IaccessPortType getIaccessPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IaccessPortType interface for invoking access web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIbasicPortType

      public static IbasicPortType getIbasicPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IbasicPortType interface for invoking core MWS web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getItaskPortType

      public static ItaskPortType getItaskPortType(AuthCredentials authCredentials) throws WSClientException
      Get the ItaskPortType interface for invoking task web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getItaskPortTypeEx

      public static ItaskPortTypeEx getItaskPortTypeEx(AuthCredentials authCredentials) throws WSClientException
      Get the IfolderPortTypeEx
      Parameters:
      authCredentials - may be null
      Throws:
      WSClientException
    • getIfolderPortType

      public static IfolderPortType getIfolderPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IfolderPortType interface for invoking folder web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIaliasPortType

      public static IaliasPortType getIaliasPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IaliasPortType interface for invoking MWS alias web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIalias2PortType

      public static Ialias2PortType getIalias2PortType(AuthCredentials authCredentials) throws WSClientException
      Get the Ialias2PortType interface for invoking the extended MWS alias web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getIsystemPortType

      public static IsystemPortType getIsystemPortType(AuthCredentials authCredentials) throws WSClientException
      Get the IsystemPortType interface for invoking the MWS system web services using the default PortalClientContext
      Parameters:
      authCredentials - the credentials to authenticate against MWS with, may be null
      Returns:
      the web service port type
      Throws:
      WSClientException
    • getPortalClientMap

      public static Map<Class<?>,com.webmethods.caf.portalclient.impl.PortalClientAPI> getPortalClientMap()
      Retrieve a map of web service interfaces and their corresponding MWS bizpolicies NOTE this is exposed for testing purposes and is not indended to be used externally
    • getPortType

      public static IWSClientProxy getPortType(AuthCredentials authCredentials, Class<?> clazz)
      Factory function to simplify getting references to the various port types exposed by the portalclient API
      Parameters:
      authCredentials - the authentication credentials to connect to MWS with
      clazz - the web service interface class to proxy
      Returns:
      A IWSClientProxy that proxies the web service interface class
    • getDefaultClientContext

      protected static PortalClientContext getDefaultClientContext()
    • initClientMap

      protected static void initClientMap()
      Initialize the map of web service interfaces and their bizpolicy names
    • addLogListener

      public static void addLogListener(ILogListener listener)
      Convenience method to add a logging listener to the WSClient used by PortalClient Logging events within the WSClient are fired to the log listeners as events.
      Parameters:
      listener - the ILogListener implementation to add
    • removeLogListener

      public static void removeLogListener(ILogListener listener)
      Convenience method to remove a logging listener to the WSClient used by PortalClient Logging events within the WSClient are fired to the log listeners as events.
      Parameters:
      listener - the ILogListener implementation to remove
    • addFailedAuthCallback

      public static void addFailedAuthCallback(IFailedAuthCallback callbackObj)
      Convenience method to add a IFailedAuthCallback handler to the WSClient used by PortalClient
      Parameters:
      callbackObj - the IFailedAuthCallback implementation to add
    • removeFailedAuthCallback

      public static void removeFailedAuthCallback(IFailedAuthCallback callbackObj)
      Convenience method to remove a IFailedAuthCallback handler to the WSClient used by PortalClient
      Parameters:
      callbackObj - the IFailedAuthCallback implementation to remove