Class PSConnection

java.lang.Object
com.seclore.fs.ws.client.pscp.PSConnection
All Implemented Interfaces:
com.seclore.fs.ws.client.exception.WSClientExceptionConstants, com.seclore.fs.ws.client.exception.WSExceptionConstants

public class PSConnection extends Object implements com.seclore.fs.ws.client.exception.WSClientExceptionConstants
This class represents an authenticated connection to the Policy Server.
  • Field Summary

    Fields inherited from interface com.seclore.fs.ws.client.exception.WSClientExceptionConstants

    APPENDER_NOT_CONFIGURED, BASIC_PROTECT_DISABLED, CLIENT_NOT_INITIALIZED, CONTENT_MODIFIES_WO_PERMISSION, DECRYPTED_CONTENT_DIGEST_MISMATCH, DECRYPTED_CONTENT_SIZE_MISMATCH, DIGEST_GENERATE_ERROR, ERROR_RESTORING_FILE, ERROR_TEMP_FILE, FAILED_FETCHING_ORGANIZATION_NAME, FAILED_TO_GENERATE_AES_KEY, FAILED_TO_PARSE_RSA_KEY, FILE_CLOSE_ERR, FILE_EXIST_AT_PROTECTEDFILENAME, FILE_EXIST_AT_UNPROTECTEDFILENAME, FILE_NOT_EXIST, FILE_NOT_SUPPORTED_WRAPPING, FILE_READ_IO_ERROR, FILE_READ_IO_ERROR_WO_NAME, FILE_WRITE_IO_ERROR, FILE_WRITE_IO_ERROR_WO_NAME, FILEEXTINFO_NOT_GIVEN, FILENAME_PROTECTEDFILENAME_ERROR, FS_HELPER_DUPLICATE_IDENTIFIER, FS_HELPER_FAILED_TO_VERIFY_CONFIG_XML, FS_HELPER_FAILED_TO_VERIFY_REQUEST_XML, FS_HELPER_IDENTIFIER_NOT_EXISTS, FS_HELPER_INVALID_INNER_ATTACHMENT_DETAILS, FS_HELPER_INVALID_RESPONSE, FS_HELPER_INVALID_SMAIL, FS_HELPER_MAIL_BODY_DETAILS_NOT_PROVIDED, FS_HELPER_MAIL_DETAILS_NOT_PROVIDED, FS_HELPER_MAIL_SENDER_NOT_PROVIDED, FS_HELPER_MISSING_CRYPTOHANDLER_IMPLEMENTATION, FS_HELPER_NOT_INITIALIZED, FS_HELPER_OBJECT_NOT_INITIALIZED, FS_HELPER_OBJECT_TERMINATED, FS_HELPER_PROTECTED_MAIL_BODY_ATTACHMENT_NOT_PROVIDED, FS_HELPER_RESPONSE_OBJECT_NOT_POPULATED, FS_HELPER_TERMINATE_ERROR, FS_HELPER_TERMINATED, HTML_BACKWARD_COMPATIBILITY_ERROR, HTML_DISPLAY_NAME_CORRUPT, HTML_DISPLAY_NAME_NOT_FOUND, HTML_FORM_DATA_CORRUPT, HTML_INVALID_VERSION_VALUE, HTML_TEMPLATE_CORRUPT, HTML_UNPROTECTED_FILE, HTML_UNWRAP_INVALID_EXT, HTML_WRAP_DISABLED, INVALID_ARRAY, INVALID_BUFFER_FILE_SIZE, INVALID_DECRYPTION, INVALID_ENCRYPTION, INVALID_ENCRYPTION_ALGO_TYPE, INVALID_FILE_SIZE, INVALID_FS_DATE_FORMAT, INVALID_FV, INVALID_HEADER_DIGEST, INVALID_INSTALLATION_PATH, INVALID_KEY, INVALID_POLICY_SERVER_URL, INVALID_VALUE_RECEIVED, INVALID_VALUE_SPECIFIED, INVALID_XML, IO_ERROR, KEY_PARAMETER_REQUIRED, LOADING_LOGGER_CONFIG_ERROR, LOGGER_NOT_CONFIGURED, MANDATORY_PARAMETER_NOT_SPECIFIED, MISSING_FILE, MISSING_LOGGER_PROPERTY_FILE, MISSING_PARAMETER, PROTECTED_FILE_MOVE_FAIL, PROTECTED_WITH_UNKNOWN_PS, PSCONNECTION_OBJECT_NULL, PSCP_CONFIG_INSTANCE_NULL, PSCP_CONFIG_MAX_POOL_SIZE, PSCP_CONNECTION_ALREADY_INITIALIZED, PSCP_CONNECTION_NOT_INITIALIZED_OR_TERMINATED, PSCP_CONNECTION_POOL_CONFIG_NOT_PROVIDED, PSCP_FAILED_TEMINATE_SESSION, PSCP_FAILED_TO_CONNECT, PSCP_FAILED_TO_FETCH_SESSION_ID, PSCP_FAILED_TO_FETCH_SESSION_KEY, PSCP_FAILED_TO_FLUSH_OUTPUT_STREAM, PSCP_FAILED_TO_OPEN_CONNECTION, PSCP_FAILED_TO_OPEN_OUTPUT_STREAM, PSCP_FAILED_TO_PARSE_PING_RESPONSE, PSCP_FAILED_TO_WRITE_DATA_OUTPUT_STREAM, PSCP_HTTP_REQUEST_INFO_IS_NULL, PSCP_INVALID_DEFAULT_SESSION_EXPIRY, PSCP_INVALID_PROXY_DETAILS, PSCP_INVALID_URL, PSCP_LOGIN_FAILED, PSCP_LOGIN_HANDLER_INSTANCE_NULL, PSCP_MISMATCH_ERROR, PSCP_NO_MORE_CONNECTION_AVAILABLE, PSCP_NO_SERVER_URL_PROVIDED, PSCP_POOL_COULD_NOT_INITIALIZE_PS_CONNECTION, PSCP_POOL_TERMINATED, PSCP_RESOURCE_URL_EMPTY_OR_NULL, PSCP_SERVER_DETAILS_IS_NULL, PSCP_UNEXPECTED_ERROR, PSCP_URL_EMPTY_OR_NULL, PSPC_FAILED_TO_CLOSE_RESPONSE_READER, PSPC_FAILED_TO_READ_RESPONSE, PSPC_SESSION_EXPIRED, RESOURCE_MANAGER_NOT_GIVEN, SEC_ERROR_TEMP_FILE, SESSION_KEY_OBJECT_NULL, SYSTEM_EXCEPTION, UNEXPECTED_ERROR, UNPROTECT_FILE_MOVE_FAIL, UNSUPPORTED_ENCODING_UTF_16LE, WSCLIENT_BLACKLISTED_EXTN_VALUE, WSCLIENT_CONFIG_NOT_GIVEN, WSCLIENT_COULD_NOT_DELETE_EXISTING_FILE, WSCLIENT_FWD_VERSION_NOT_SUPPORTED, WSCLIENT_HTML_UNWRAPPING_VERSION_NOT_SUPPORTED, WSCLIENT_HTML_WRAPPING_BUFFER_VERSION_NOT_SUPPORTED, WSCLIENT_HTML_WRAPPING_DATA_VERSION_NOT_SUPPORTED, WSCLIENT_SUPPORTED_EXTN_BASIC_PROTECTION, XML_PARSE_DOCUMENT_ERROR, XML_PARSE_NODE_ERROR, XML_PARSE_VALUE_ERROR

    Fields inherited from interface com.seclore.fs.ws.client.exception.WSExceptionConstants

    EXT_NOT_SUPPORTED, FILECONTENT_MODIFIED, INVALID_FILE, OPEN_EXCLUSIVE_FAIL, PROTECTED_FILE, RESPONSE_ERROR, UNPROTECTED_FILE, WSCLIENT_VERSION_NOT_SUPPORTED
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method add a feature to the supported features list.
    byte[]
    encryptWithSessionKey(byte[] pPlainData)
    Encrypts the data with session key.
    com.seclore.fs.ws.client.pscp.CryptoHandler
    CryptoHandler object.
    Key Id which was used during the authentication process.
    Enterprise Application ID with which the Connection is authenticated.
     
    This method returns the unique identifier of the connection.
    getInstance(String pPoolId, boolean pIsPooledConnection, com.seclore.fs.ws.client.pscp.Config pConfig, String pURL, com.seclore.fs.ws.client.pscp.CryptoHandler pCryptoHandler)
    This method returns the instance of PSConnection.
    In the process of returning the connection,it will first try with the given url.
    If connection fails with the given url,it will enumerate all the configured urls in the server details implementation and tries to get connection with each of them.
    finally it returns the successful connection with url or null if connection is not successful with any configured url.
     
     
    This method returns the authenticated session id.
    This method returns the URL with which PSConnection is authenticated with the Policy Server.
    boolean
    Whether or not connection has CryptoHandler.
    boolean
    Is the connection has SessionKey
    boolean
    If feature is supported by Policy Server.
    boolean
     
    boolean
     
    boolean
    Whether or not the connection is for pool.
    boolean
     
    com.seclore.fs.ws.client.pscp.HttpResponseInfo
    send(Locale pLocale, com.seclore.fs.ws.client.pscp.HttpRequestInfo pHttpRequestInfo)
    Send a request to the server and returns the HttpResponseInfo instance.
    com.seclore.fs.ws.client.pscp.HttpResponseInfo
    sendRequest(int pRequestType, String pRequestXML)
    This method is used to send the request to policy server.
    void
    setHtmlWrapperVersion(Node pHtmlWrapperVersion)
     
    void
    setPSId(String pPSId)
     
    void
    setSessionKey(com.seclore.fs.ws.client.encryption.EncryptionKey pSessionKey)
    This method sets the session key for the connection.
    void
    setTimeOut(int pTimeOut)
    This method sets the timeout for the connection.
    void
    This method releases all the resources occupied by this connection.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • terminate

      public void terminate() throws com.seclore.fs.ws.client.pscp.exception.PSCPException
      This method releases all the resources occupied by this connection. It also invalidates the session on the Policy Server.
      Throws:
      com.seclore.fs.ws.client.pscp.exception.PSCPException
    • encryptWithSessionKey

      public byte[] encryptWithSessionKey(byte[] pPlainData) throws com.seclore.fs.ws.client.exception.WSClientException
      Encrypts the data with session key.
      Parameters:
      pPlainData - The data to encrypt.
      Returns:
      Encrypted data as byte array.
      Throws:
      com.seclore.fs.ws.client.exception.WSClientException
    • getSessionId

      public String getSessionId()
      This method returns the authenticated session id. It can be used by the integrating application to redirect the user to the Policy Server.
      Returns:
      the authenticated session id.
    • getEnterpriseApplicationID

      public String getEnterpriseApplicationID()
      Enterprise Application ID with which the Connection is authenticated.
      Returns:
      Enterprise Application ID with which the Connection is authenticated.
    • getCryptoHandlerKeyID

      public String getCryptoHandlerKeyID()
      Key Id which was used during the authentication process.
      Returns:
      Key Id which was used during the authentication process.
    • getCryptoHandler

      public com.seclore.fs.ws.client.pscp.CryptoHandler getCryptoHandler()
      CryptoHandler object.
      Returns:
      CryptoHandler object.
    • hasCryptoHandler

      public boolean hasCryptoHandler()
      Whether or not connection has CryptoHandler.
      Returns:
      Whether or not connection has CryptoHandler.
    • hasSupportedFeature

      public boolean hasSupportedFeature(String pFeatureId)
      If feature is supported by Policy Server.
      Parameters:
      pFeatureId -
      Returns:
      If feature is supported by Policy Server.
    • addSupportedFeature

      public void addSupportedFeature(String pFeatureID)
      This method add a feature to the supported features list.
      Parameters:
      pFeatureID - Id of the feature.
    • isPooledConnection

      public boolean isPooledConnection()
      Whether or not the connection is for pool.
      Returns:
      Whether or not the connection is for pool.
    • setSessionKey

      public void setSessionKey(com.seclore.fs.ws.client.encryption.EncryptionKey pSessionKey)
      This method sets the session key for the connection.
      Parameters:
      pSessionKey - - EncryptionKey
    • hasSessionKey

      public boolean hasSessionKey()
      Is the connection has SessionKey
      Returns:
      Is the connection has SessionKey
    • send

      public com.seclore.fs.ws.client.pscp.HttpResponseInfo send(Locale pLocale, com.seclore.fs.ws.client.pscp.HttpRequestInfo pHttpRequestInfo) throws com.seclore.fs.ws.client.pscp.exception.PSCPSessionExpiredException, com.seclore.fs.ws.client.pscp.exception.PSCPException
      Send a request to the server and returns the HttpResponseInfo instance.
      This method does not parse the response XML to check if server has returned success or failure.
      It only takes care of errors where server is not reachable or the HTTP session with the server has expired.
      Parameters:
      pLocale - The Locale instance to pass to the server.
      pHttpRequestInfo - The HttpRequestInfo instance.
      Returns:
      The HttpResponseInfo instance if send success.
      Throws:
      com.seclore.fs.ws.client.pscp.exception.PSCPSessionExpiredException - In case session is expired.
      com.seclore.fs.ws.client.pscp.exception.PSCPException - The PSCPExcpetion instance in case of any error while sending the request. It throws PSCPSessionExpiredException instance if the session with Policy Server has expired.
    • getId

      public String getId()
      This method returns the unique identifier of the connection.
      Returns:
      the connection identifier.
    • setTimeOut

      public void setTimeOut(int pTimeOut)
      This method sets the timeout for the connection.
      Parameters:
      pTimeOut - Time Out value in seconds.
    • getURL

      public String getURL()
      This method returns the URL with which PSConnection is authenticated with the Policy Server. This methods can be user in conjunction with getSessionId() to redirect the user to Policy Server.
      Returns:
      the mstrURL
    • getPSId

      public String getPSId()
    • setPSId

      public void setPSId(String pPSId)
    • isTerminated

      public boolean isTerminated()
    • getInstance

      public static PSConnection getInstance(String pPoolId, boolean pIsPooledConnection, com.seclore.fs.ws.client.pscp.Config pConfig, String pURL, com.seclore.fs.ws.client.pscp.CryptoHandler pCryptoHandler) throws com.seclore.fs.ws.client.pscp.exception.PSCPException
      This method returns the instance of PSConnection.
      In the process of returning the connection,it will first try with the given url.
      If connection fails with the given url,it will enumerate all the configured urls in the server details implementation and tries to get connection with each of them.
      finally it returns the successful connection with url or null if connection is not successful with any configured url.
      Parameters:
      pPoolId - Represents the pool ID
      pIsPooledConnection - : Whether or not the connection is for pool
      pConfig - Represents the configuration to use.
      pURL - Represents the URL to connect with.
      pCryptoHandler - : CryptoHandler to encrypt and decrypt the protocol for secure communication
      Returns:
      PSConnection instance.
      Throws:
      com.seclore.fs.ws.client.pscp.exception.PSCPException
    • sendRequest

      public com.seclore.fs.ws.client.pscp.HttpResponseInfo sendRequest(int pRequestType, String pRequestXML) throws com.seclore.fs.ws.client.pscp.exception.PSCPException
      This method is used to send the request to policy server.
      Parameters:
      pRequestType - : The request type
      pRequestXML - : The request XML.
      Returns:
      An instance of HttpResponseInfo which the caller can manipulate later.
      Throws:
      com.seclore.fs.ws.client.pscp.exception.PSCPException - In case of any error while sending or processing the request.
    • getOrganizationName

      public String getOrganizationName()
    • isHtmlWrapEnabled

      public boolean isHtmlWrapEnabled()
    • getHtmlWrapperVersion

      public Node getHtmlWrapperVersion()
    • setHtmlWrapperVersion

      public void setHtmlWrapperVersion(Node pHtmlWrapperVersion)
    • isBasicProtectionEnabled

      public boolean isBasicProtectionEnabled()