Class P3BindSession

java.lang.Object
com.isode.x400api.Session
com.isode.x400.highlevel.P3BindSession
Direct Known Subclasses:
P7BindSession

public class P3BindSession extends Session
Abstracts the connection used for submission to a P3 channel and/or P7 message store The documentation in the examples here refer to P3 channel. The class MStore extends this class and adds P7 Message Store specific methods, like listing the content of a mailbox, deleting messages, etc.
  • Field Details

    • pa

      protected String pa
      Presentation Address of the P3 channel
    • user_oraddr

      protected String user_oraddr
      P3 user O/R address
    • user_dn

      protected String user_dn
      P3 user DN
    • credentials

      protected String credentials
      The password for the P3 user
    • disable_config_requests

      protected boolean disable_config_requests
      Disable configuration requests in MS bind operations
    • bound

      protected boolean bound
      Boolean value that represents if the session is bound or not
    • sec_init

      protected boolean sec_init
      Boolean value that represents if the security environment has been initialized or not
    • available

      protected static final Semaphore available
  • Constructor Details

    • P3BindSession

      public P3BindSession(String presentation_address, String or_addr, String passwd)
      Create a P3BindSession
      Parameters:
      presentation_address - the P3 channel's Presentation Address Typical values are "593"/Internet=myserver.mycompany.com
      or_addr - the string encoded O/R address of the P3 channel user. For example /"cn=John Smith, o=Address Book, o=Isode, c=GB"
      passwd - the P3 channel's password that correspond to the user
    • P3BindSession

      public P3BindSession(String presentation_address, String or_addr, String passwd, boolean submit_only)
      Create a P3BindSession, specifying whether the session should be used for Submission only or not.
      Parameters:
      presentation_address - the P3 channel's Presentation Address Typical values are "593"/Internet=myserver.mycompany.com
      or_addr - the string encoded O/R address of the P3 channel user. For example /"cn=John Smith, o=Address Book, o=Isode, c=GB"
      passwd - the P3 channel's password that correspond to the user
      submit_only - Set to true if this session is only to be used for submission
  • Method Details

    • setUserDN

      public void setUserDN(String my_user_dn) throws BadDNException
      Set the P3 channel user's DN

      This is the string encoded O/R address of the user. For example /"cn=John Smith, o=Address Book, o=Isode, c=GB"

      Throws:
      BadDNException
    • setDisableConfigRequest

      public void setDisableConfigRequest(boolean b)
      Enables or disables the request of configuration from the MTA or Message Store. This will be needed by some non-Isode Message Stores or MTAs, like the Deutsche Telekom service.
      Parameters:
      b -
    • acquireSemaphore

      protected void acquireSemaphore() throws InterruptedException
      Throws:
      InterruptedException
    • releaseSemaphore

      protected void releaseSemaphore()
    • bind

      public void bind() throws X400APIException
      Bind to the P3 channel
      Throws:
      X400APIException
    • getSession

      public Session getSession()
      Retrieve the Session object
      Returns:
      A Session object. This is the object that is need to, for example, read or create a message
    • isBound

      public boolean isBound()
      Check if this session is bound or not.

      This means that the application think it is still bound to the server, but bear in mind that the connection may have been dropped by the server for any number of reasons, and this application won't be informed.

      Returns:
      Returns true if the session bind() was successful and unbind() was not called.
    • unbind

      public void unbind() throws X400APIException
      Unbind from the P3 channel or P7 Message Store.

      Closes the connection to the the P3 channel or P7 Message Store. No more messages can be sent or received until a new connection is open.

      Throws:
      X400APIException
    • unbind

      public void unbind(boolean force) throws X400APIException
      Unbind from the P3 channel or P7 Message Store.

      Closes the connection to the the P3 channel or P7 Message Store. No more messages can be sent or received until a new connection is open.

      Parameters:
      force - ignore InterruptedException when acquiring semaphore
      Throws:
      X400APIException
    • setSecurityEnv

      public void setSecurityEnv(String id, String id_dn, String pass) throws X400APIException
      Set the session's security environment data.

      The information is passed on to the underlying API, but is not checked at this stage. This means that the information may be invalid, but won't be noticed until later on.

      Parameters:
      pkcs12file - - The absolute path of the PKCS#12 file with the user certificate
      pkcs12password - - The password for the PKCS#12 user certificate
      sec_trusted_ca_cert_dir - - The directory where the trusted certificates for the CAs are kept
      Throws:
      X400APIException
    • setSecurityEnvPKCS12

      public void setSecurityEnvPKCS12(String pkcs12FileName, String password, String sec_trusted_ca_cert_dir) throws X400APIException
      Set the session's security environment data.

      The information is passed on to the underlying API, but is not checked at this stage. This means that the information may be invalid, but won't be noticed until later on.

      Parameters:
      pkcs12FileName - String : The PKCS#12 file that corresponds to this user, containing it's O/R address
      password - String : Passphrase to open the PKCS#12 file
      sec_trusted_ca_cert_dir - : the directory where the CA's trusted certificates are kept (optional)
      Throws:
      X400APIException
      Since:
      15.0
    • receiveNextAvailableMessage

      public ReceiveMsg receiveNextAvailableMessage() throws X400APIException
      Receive the "next available message" from the Message Store
      Throws:
      X400APIException
    • waitForNewMessages

      public int waitForNewMessages(int seconds) throws X400APIException
      Wait for a new message the specified number of seconds. If seconds is 0, then there's no wait. If seconds is negative, then the delay is indefinite.
      Parameters:
      seconds -
      Returns:

      X400_att.X400_E_NOERROR if there were no errors and a message is ready to be read

      X400_att.X400_E_TIMED_OUT: if no messages arrived in the specified number of seconds

      X400_att.X400_E_NO_MESSAGE: if there are no more messages to read

      Throws:
      X400APIException