Class DSapi

  • All Implemented Interfaces:
    SWIG_DSAPIConstants

    public class DSapi
    extends java.lang.Object
    implements SWIG_DSAPIConstants
    This class provides miscellaneous static methods which may be useful to Java DSAPI clients
    • Constructor Detail

      • DSapi

        public DSapi()
    • Method Detail

      • getDSAPIVersion

        public static int getDSAPIVersion()
        Determine the version of the DSAPI library which is currently being used. This is the version returned by the DSAPI library itself at run-time: it won't necessarily be the same as the version of DSAPI that was used to build Java DSAPI.
        Returns:
        the DSAPI library version.
      • getJavaDSAPIVersion

        public static int getJavaDSAPIVersion()
        Determine the version of the native component of the Java DSAPI library which is currently being used. This is the version returned by the library itself at run-time: it won't necessarily be the same as the version that was used when this Java class was built.
        Returns:
        the Java DSAPI library version.
      • initialize

        public static void initialize​(java.lang.String appName)
                               throws NativeLibraryException
        Ensure that the Java DSAPI library has been initialized. The library must be initialized before using any of the other Java DSAPI classes.

        It is safe to call this method multiple times.

        Note that the Java DSAPI library uses com.isode.util.Logger to generate logging messages. When this method is called, then a log handler is configured which sends messages to the Isode log system using the message facility "javadsapimsg". This log handler is in addition to any other handlers which may have been configured by the user.

        Parameters:
        appName - the identifier to be used for a logstream that will capture all Isode DUA logging events. logstreamName may be null, in which case no DUA messages will be logged. Once DUA logging has been initialised, subsequent call to this method subsequent calls that specify appName will have no effect (the first caller is the one whose appName gets used).
        Throws:
        NativeLibraryException - if it was not possible to initialize the library; any subsequent attempts to use the library will probably fail.
      • initialize

        public static void initialize()
                               throws NativeLibraryException
        Initialize the DSAPI library without setting up an Isode DUA logging stream.
        Throws:
        NativeLibraryException - if it was not possible to initialize the library; any subsequent attempts to use the library will probably fail.
        See Also:
        Logger, dsapiInitialize(String)
      • initializeSecurity

        public static void initializeSecurity​(java.lang.String secPath)
                                       throws NativeLibraryException
        Initialize the X.509 library
        Parameters:
        secPath - the path to use for X.509 credentials. This may be null, in which case the DSAPI library will supply a suitable default value.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • syntaxIDToName

        public static java.lang.String syntaxIDToName​(int syntaxID)
                                               throws NativeLibraryException
        Get a string representation of the syntax name for the specified syntax identifier. This may or may not return a useful value.
        Parameters:
        syntaxID - the syntax ID in question
        Returns:
        A string representation of syntaxID (such as "ia5string"), or null if no name is available.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • nameToSyntaxID

        public static int nameToSyntaxID​(java.lang.String syntaxName)
                                  throws NativeLibraryException,
                                         java.lang.NullPointerException
        Get the syntax identifier associated with the given syntax name.
        Parameters:
        syntaxName - Syntax name (for example, "ia5string"). Must not be null.
        Returns:
        an integer that identifies this syntax.
        Throws:
        java.lang.NullPointerException - if syntaxName is null.
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • getBuildVersion

        public static java.lang.String getBuildVersion​(boolean fullInfo)
                                                throws NativeLibraryException
        Returns a String containing information about the library build version. This method cannot be called until the library has been initialized.

        The String returned by this method is derived from the Isode build version. A full version string might look something like isodejavalib 12.0a0-0-pt #335 (build.system.net) of Fri Aug 11 15:31:33 BST 2006 (dsapi:2008; javadsapi:2). An abbreviated version string will be of the form "R12.0v0".

        Parameters:
        fullInfo - true to return a long-form String, false otherwise.
        Returns:
        a version string.
        Throws:
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • isIsodeServer

        public static boolean isIsodeServer​(DirectorySession ds,
                                            DN dn)
        Determine if the entry at a specified DN appears to be entry used for storing Isode server configuration (e.g. a DSA, or MTA, or M-Link or M-Box server).
        Parameters:
        ds - Bound Directory session; most not be null.
        dn - Given DN; must not be null.
        Returns:
        true if the entry appears to relate to an Isode server; false otherwise.
        Since:
        15.0
      • getSupportedSaslMech

        public static java.lang.String getSupportedSaslMech()
                                                     throws NativeLibraryException
        Returns space separated list of supported SASL mechanisms. (depending on OS and installed SASL plug-ins).
        Returns:
        string with space separated list of SASL mechanisms
        Throws:
        NativeLibraryException
        Since:
        16.1