Class NuixLicenseResolver

    • Field Detail

      • customSource

        protected java.lang.String customSource
      • serverHost

        protected java.lang.String serverHost
      • serverPort

        protected int serverPort
      • credentialsCallback

        protected nuix.engine.CredentialsCallback credentialsCallback
      • certificateTrustCallback

        protected nuix.engine.CertificateTrustCallback certificateTrustCallback
      • requiredFeatures

        protected java.util.Set<java.lang.String> requiredFeatures
      • minWorkerCount

        protected int minWorkerCount
      • maxWorkerCount

        protected int maxWorkerCount
      • targetShortName

        protected java.lang.String targetShortName
      • finalDecider

        protected java.util.function.Function<java.util.stream.Stream<nuix.engine.AvailableLicence>,​java.util.Optional<nuix.engine.AvailableLicence>> finalDecider
    • Constructor Detail

      • NuixLicenseResolver

        protected NuixLicenseResolver()
    • Method Detail

      • fromServer

        public static NuixLicenseResolver fromServer​(@NonNull
                                                     @NonNull java.lang.String host,
                                                     int port)
        Creates an instance specifically for resolving a license from a Nuix Management Server (NMS) instance.
        Parameters:
        host - The host/ip of the NMS server.
        port - The port of the NMS server.
        Returns:
        An NMS specific license resolver
      • fromServer

        public static NuixLicenseResolver fromServer​(@NonNull
                                                     @NonNull java.lang.String host)
        Creates an instance specifically for resolving a license from a Nuix Management Server (NMS) instance. Similar to calling fromServer(String, int) with a port of 27443 (the default).
        Parameters:
        host - The host/ip of the NMS server.
        Returns:
        An NMS specific license resolver
      • fromDongle

        public static NuixLicenseResolver fromDongle()
        Creates an instance specifically for resolving a physical dongle based license.
        Returns:
        A dongle specific license resolver.
      • fromCloud

        public static NuixLicenseResolver fromCloud()
        Creates an instance specifically for resolving a license from the Nuix Cloud License Server (CLS).
        Returns:
        A CLS specific license resolver.
      • fromAnySource

        public static NuixLicenseResolver fromAnySource()
        Creates an instance which places no constraints on where the license is obtained from. When using this, no "sources" parameter is provided to the licensor, allowing for a license to be obtained from all sources that the engine is able to locate.
        Returns:
        A license resolver that is indifferent to where the license comes from.
      • fromCustomSource

        public static NuixLicenseResolver fromCustomSource​(@NonNull
                                                           @NonNull java.lang.String customSource)
        Creates an instance that will specify a custom source.
        Parameters:
        customSource - The custom source value to provide.
        Returns:
        A license resolver that uses a custom license source.
      • withRequiredFeatures

        public NuixLicenseResolver withRequiredFeatures​(java.lang.String... features)
        Specifies a list of one or more features that a license must have to be acceptable.
        Parameters:
        features - The required features.
        Returns:
        This license resolver for chained method calls.
      • withRequiredFeatures

        public NuixLicenseResolver withRequiredFeatures​(java.util.Collection<java.lang.String> features)
        Specifies a list of one or more features that a license must have to be acceptable.
        Parameters:
        features - The required features.
        Returns:
        This license resolver for chained method calls.
      • withMinWorkerCount

        public NuixLicenseResolver withMinWorkerCount​(int minWorkerCount)
        Specifies a minimum worker count a given license must have to be acceptable.
        Parameters:
        minWorkerCount - The minimum worker count. A value of 0 means no minimum.
        Returns:
        This license resolver for chained method calls.
      • withMaxWorkerCount

        public NuixLicenseResolver withMaxWorkerCount​(int maxWorkerCount)
        Specifies a maximum worker count a license can have to be acceptable. This exists mostly to help in situations where you might have a license with a small amount of workers and another with a larger amount of workers to assist in preventing acquisition of the larger worker count license.
        Parameters:
        maxWorkerCount - The maximum worker count. A value of 0 means no maximum.
        Returns:
        This license resolver for chained method calls.
      • withFinalDecisionMadeBy

        public NuixLicenseResolver withFinalDecisionMadeBy​(@NonNull
                                                           @NonNull java.util.function.Function<java.util.stream.Stream<nuix.engine.AvailableLicence>,​java.util.Optional<nuix.engine.AvailableLicence>> finalDecider)
        Allows you to provide a function which makes the final decision as to which available license to obtain. Supplied function will be provided Stream of AvailableLicenses after this license resolver has applied any filtering that it may have applied.
        Parameters:
        finalDecider - A function that can make the final choice of which (if any) license to acquire.
        Returns:
        This license resolver for chained method calls.
      • withLicenseCredentialsProvider

        public NuixLicenseResolver withLicenseCredentialsProvider​(nuix.engine.CredentialsCallback credentialsCallback)
        Allows you to provider a license credentials callback used for license authentication (CLS/NMS).
        Parameters:
        credentialsCallback - The custom credentials callback
        Returns:
        This license resolver for chained method calls.
      • withLicenseCredentials

        public NuixLicenseResolver withLicenseCredentials​(java.lang.String userName,
                                                          java.lang.String password)
        Allows you to specify the specific username and password to use for license authentication (CLS/NMS)
        Parameters:
        userName - The username to use
        password - The password to use
        Returns:
        This license resolver for chained method calls.
      • withLicenseCredentialsResolvedFromEnvVars

        public NuixLicenseResolver withLicenseCredentialsResolvedFromEnvVars​(java.lang.String usernameEnvVar,
                                                                             java.lang.String passwordEnvVar)
        Allows you to specify Environment variables to resolve the license authentication username and password from.
        Parameters:
        usernameEnvVar - The name of the environment variable
        passwordEnvVar - The password of the environment variable
        Returns:
        This license resolver for chained method calls.
      • withLicenseCredentialsResolvedFromEnvVars

        public NuixLicenseResolver withLicenseCredentialsResolvedFromEnvVars()
        Specifies that license authentication credentials will be obtained from environment variables. The value of username will be pulled from "NUIX_USERNAME" and the value of password will be pulled from "NUIX_PASSWORD".
        Returns:
        This license resolver for chained method calls.
      • withCertificateTrustCallback

        public NuixLicenseResolver withCertificateTrustCallback​(nuix.engine.CertificateTrustCallback certificateTrustCallback)
        Specifies a certificate trust callback.
        Parameters:
        certificateTrustCallback - The certificate trust callback.
        Returns:
        This license resolver for chained method calls.
      • withTrustAllCertificates

        public NuixLicenseResolver withTrustAllCertificates()
        Specifies a certificate trust callback that blindly accepts all certificates. This is the default behavior of license resolver.
        Returns:
        This license resolver for chained method calls.
      • resolveLicense

        public boolean resolveLicense​(@NonNull
                                      @NonNull nuix.engine.Engine engine)
                               throws java.lang.Exception
        Attempts to license the provided Engine instance using resolution and filtering configuration of this instance.
        Specified by:
        resolveLicense in interface LicenseResolver
        Parameters:
        engine - The engine instance to attempt to license.
        Returns:
        True if a license was obtained, false if not.
        Throws:
        java.lang.Exception - Exceptions thrown by any of the methods working to obtain a license will be uncaught and allowed to bubble up for caller to respond to.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object