Class ATNds


  • public class ATNds
    extends java.lang.Object
    This class provides various static methods that allow ATNds functionality.

    In cases where conversions are performed, the result is returned in a ATNdsResult object which has String and DN components. For example:

       import com.isode.dsapi.atnds.ATNds;
       import com.isode.dsapi.atnds.ATNds.ATNdsResult;
    
       ...
    
       // Assume "ds" has been  bound to a suitable directory
    
       ATNdsResult conversionResult = null;
       registryDN = new DN("o=Isode-MD-Register");
       aftnAddress = "LFCIZPZX"; // caas
    
       try {
           System.out.println("converting aftnAddress : " + aftnAddress + "...");
           conversionResult = ATNds.convertAFTN2AMHS(ds,registryDN,aftnAddress);
           if (conversionResult.getString() != null) {
              System.out.println("O/R Address = " + conversionResult.getString());
           }
           if (conversionResult.getDN() != null) {
              System.out.println("user DN = " + conversionResult.getDN());
           }
       } catch (DSAPIException e) {
           System.out.println("Conversion failed : " + e);
       }
    
       // If an O/R address was returned, try reversing the conversion
       String ora = conversionResult.getString();
       if (ora != null) {
           try {
               System.out.println("converting O/R Address : " + ora);
               conversionResult = ATNds.convertAMHS2AFTN(ds, registryDN, ora);
    
               if (conversionResult.getString() != null) {
                   System.out.println("AFTN Address = " + conversionResult.getString());
               }
               if (conversionResult.getDN() != null) {
                   System.out.println("user DN = " + conversionResult.getDN());
               }
           } catch (DSAPIException e) {
               System.out.println("Reverse conversion failed : " + e);
           }
        }
     
    Since:
    15.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ATNds.ATNdsResult
      An object which returns the result of an ATNds conversion.
    • Constructor Summary

      Constructors 
      Constructor Description
      ATNds()  
    • Constructor Detail

      • ATNds

        public ATNds()
    • Method Detail

      • convertAFTN2AMHS

        public static ATNds.ATNdsResult convertAFTN2AMHS​(DirectorySession directorySession,
                                                         DN registryDN,
                                                         java.lang.String aftnAddress)
                                                  throws NativeLibraryException,
                                                         BadValueException,
                                                         NotBoundException,
                                                         DSAPIException
        Convert an AFTN address to the AMHS O/R address. If the user has an associated directory entry, the distinguished name of that is returned as well.
        Parameters:
        directorySession - an open directory session. Must not be null.
        registryDN - DN of ICAO or local registry. Must not be null.
        aftnAddress - AFTN address to convert. Must be a non-null String of length 8.
        Returns:
        an ATNdsResult containing the contents of the conversion, which will contain
        • the O/R address string, or null if the address could not be found (use getString())
        • the DN of the user entry, or null if none could be found (use getDN())
        Throws:
        BadValueException - if aftnAddress is not 8 characters long
        NativeLibraryException - if an unrecoverable error occurred in the native library
        NotBoundException - if ds is not bound
        DSAPIException - if a non-fatal error occurred which meant that no conversion could be done.
      • convertAMHS2AFTN

        public static ATNds.ATNdsResult convertAMHS2AFTN​(DirectorySession directorySession,
                                                         DN registryDN,
                                                         java.lang.String x400ORAddress)
                                                  throws NativeLibraryException,
                                                         NotBoundException,
                                                         DSAPIException
        Return the AFTN address associated with the given AMHS O/R address. If the user has an associated directory entry then the distinguished name of this is also returned.
        Parameters:
        directorySession - an open directory session
        registryDN - DN of ICAO or local registry
        x400ORAddress - X400 O/R address to convert
        Returns:
        an ATNdsResult containing the contents of the conversion, which will contain
        • the returned AFTN address (use getString())
        • the DN of the user entry, or null if none is present (use getDN())
        Throws:
        NativeLibraryException - if an unrecoverable error occurred in the native library
        NotBoundException - if ds is not bound
        DSAPIException - if a non-fatal error occurred which meant that no conversion could be done.