Interface RepositorySystemSession.SessionBuilder

    • Method Detail

      • setOffline

        RepositorySystemSession.SessionBuilder setOffline​(boolean offline)
        Controls whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.
        Parameters:
        offline - true if the repository system is in offline mode, false otherwise.
        Returns:
        This session for chaining, never null.
      • setIgnoreArtifactDescriptorRepositories

        RepositorySystemSession.SessionBuilder setIgnoreArtifactDescriptorRepositories​(boolean ignoreArtifactDescriptorRepositories)
        Controls whether repositories declared in artifact descriptors should be ignored during transitive dependency collection. If enabled, only the repositories originally provided with the collect request will be considered.
        Parameters:
        ignoreArtifactDescriptorRepositories - true to ignore additional repositories from artifact descriptors, false to merge those with the originally specified repositories.
        Returns:
        This session for chaining, never null.
      • setResolutionErrorPolicy

        RepositorySystemSession.SessionBuilder setResolutionErrorPolicy​(ResolutionErrorPolicy resolutionErrorPolicy)
        Sets the policy which controls whether resolutions errors from remote repositories should be cached.
        Parameters:
        resolutionErrorPolicy - The resolution error policy for this session, may be null if resolution errors should generally not be cached.
        Returns:
        This session for chaining, never null.
      • setArtifactDescriptorPolicy

        RepositorySystemSession.SessionBuilder setArtifactDescriptorPolicy​(ArtifactDescriptorPolicy artifactDescriptorPolicy)
        Sets the policy which controls how errors related to reading artifact descriptors should be handled.
        Parameters:
        artifactDescriptorPolicy - The descriptor error policy for this session, may be null if descriptor errors should generally not be tolerated.
        Returns:
        This session for chaining, never null.
      • setLocalRepositoryManager

        RepositorySystemSession.SessionBuilder setLocalRepositoryManager​(LocalRepositoryManager localRepositoryManager)
        Sets the local repository manager used during this session. Note: Eventually, a valid session must have a local repository manager set.

        The provisioning of LocalRepositoryManager for use with this method introduces chicken and egg situation. Integrators MUST NOT use this method, but instead, hook into Local Repository Manager Provider by any means they can (ie by using Provider or Sisu Components) and use custom string and/or priorities instead. This method existence is not meant for "everyday use" (normal session creation), but for some more advanced use cases. Do not use it, unless you know what are you doing.

        Parameters:
        localRepositoryManager - The local repository manager used during this session, may be null.
        Returns:
        This session for chaining, never null.
      • setWorkspaceReader

        RepositorySystemSession.SessionBuilder setWorkspaceReader​(WorkspaceReader workspaceReader)
        Sets the workspace reader used during this session. If set, the workspace reader will usually be consulted first to resolve artifacts.
        Parameters:
        workspaceReader - The workspace reader for this session, may be null if none.
        Returns:
        This session for chaining, never null.
      • setSystemProperties

        RepositorySystemSession.SessionBuilder setSystemProperties​(java.util.Map<?,​?> systemProperties)
        Sets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually collected from the runtime environment like System.getProperties() and environment variables.

        Note: System properties are of type Map<String, String> and any key-value pair in the input map that doesn't match this type will be silently ignored.

        Parameters:
        systemProperties - The system properties, may be null or empty if none.
        Returns:
        This session for chaining, never null.
      • setSystemProperty

        RepositorySystemSession.SessionBuilder setSystemProperty​(java.lang.String key,
                                                                 java.lang.String value)
        Sets the specified system property.
        Parameters:
        key - The property key, must not be null.
        value - The property value, may be null to remove/unset the property.
        Returns:
        This session for chaining, never null.
      • setUserProperties

        RepositorySystemSession.SessionBuilder setUserProperties​(java.util.Map<?,​?> userProperties)
        Sets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to system properties but are set on the discretion of the user and hence are considered of higher priority than system properties in case of conflicts.

        Note: User properties are of type Map<String, String> and any key-value pair in the input map that doesn't match this type will be silently ignored.

        Parameters:
        userProperties - The user properties, may be null or empty if none.
        Returns:
        This session for chaining, never null.
      • setUserProperty

        RepositorySystemSession.SessionBuilder setUserProperty​(java.lang.String key,
                                                               java.lang.String value)
        Sets the specified user property.
        Parameters:
        key - The property key, must not be null.
        value - The property value, may be null to remove/unset the property.
        Returns:
        This session for chaining, never null.
      • setConfigProperties

        RepositorySystemSession.SessionBuilder setConfigProperties​(java.util.Map<?,​?> configProperties)
        Sets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, connector-specific behavior, etc.).

        Note: Configuration properties are of type Map<String, Object> and any key-value pair in the input map that doesn't match this type will be silently ignored.

        Parameters:
        configProperties - The configuration properties, may be null or empty if none.
        Returns:
        This session for chaining, never null.
      • setConfigProperty

        RepositorySystemSession.SessionBuilder setConfigProperty​(java.lang.String key,
                                                                 java.lang.Object value)
        Sets the specified configuration property.
        Parameters:
        key - The property key, must not be null.
        value - The property value, may be null to remove/unset the property.
        Returns:
        This session for chaining, never null.
      • setMirrorSelector

        RepositorySystemSession.SessionBuilder setMirrorSelector​(MirrorSelector mirrorSelector)
        Sets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to denote the effective repositories.
        Parameters:
        mirrorSelector - The mirror selector to use, may be null.
        Returns:
        This session for chaining, never null.
      • setProxySelector

        RepositorySystemSession.SessionBuilder setProxySelector​(ProxySelector proxySelector)
        Sets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their proxy (if any) already set.
        Parameters:
        proxySelector - The proxy selector to use, may be null.
        Returns:
        This session for chaining, never null.
        See Also:
        RemoteRepository.getProxy()
      • setAuthenticationSelector

        RepositorySystemSession.SessionBuilder setAuthenticationSelector​(AuthenticationSelector authenticationSelector)
        Sets the authentication selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their authentication (if any) already set.
        Parameters:
        authenticationSelector - The authentication selector to use, may be null.
        Returns:
        This session for chaining, never null.
        See Also:
        RemoteRepository.getAuthentication()
      • setVersionFilter

        RepositorySystemSession.SessionBuilder setVersionFilter​(VersionFilter versionFilter)
        Sets the version filter to use for building dependency graphs.
        Parameters:
        versionFilter - The version filter to use for building dependency graphs, may be null to not filter versions.
        Returns:
        This session for chaining, never null.
      • setData

        RepositorySystemSession.SessionBuilder setData​(SessionData data)
        Sets the custom data associated with this session. Note: When this method used to set instance, same passed instance will be used for every built session out of this builder instance, hence the built sessions will share these instances as well!
        Parameters:
        data - The session data, may be null.
        Returns:
        This session for chaining, never null.
      • setCache

        RepositorySystemSession.SessionBuilder setCache​(RepositoryCache cache)
        Sets the cache the repository system may use to save data for future reuse during the session. Note: When this method used to set instance, same passed instance will be used for every built session out of this builder instance, hence the built sessions will share these instances as well!
        Parameters:
        cache - The repository cache, may be null if none.
        Returns:
        This session for chaining, never null.
      • addOnSessionEndedHandler

        RepositorySystemSession.SessionBuilder addOnSessionEndedHandler​(java.lang.Runnable handler)
        Adds on session ended handler to be immediately registered when this builder creates session.
        Parameters:
        handler - The on session ended handler, may not be null.
        Returns:
        The session for chaining, never null.
      • setSessionDataSupplier

        RepositorySystemSession.SessionBuilder setSessionDataSupplier​(java.util.function.Supplier<SessionData> dataSupplier)
        Sets the custom session data supplier associated with this session. Note: The supplier will be used for every built session out of this builder instance, so if supplier supplies same instance the built sessions will share these instances as well!
        Parameters:
        dataSupplier - The session data supplier, may not be null.
        Returns:
        This session for chaining, never null.
      • setRepositoryCacheSupplier

        RepositorySystemSession.SessionBuilder setRepositoryCacheSupplier​(java.util.function.Supplier<RepositoryCache> cacheSupplier)
        Sets the cache supplier for the repository system may use to save data for future reuse during the session. Note: The supplier will be used for every built session out of this builder instance, so if supplier supplies same instance the built sessions will share these instances as well!
        Parameters:
        cacheSupplier - The repository cache supplier, may not be null.
        Returns:
        This session for chaining, never null.
      • withLocalRepositoryBaseDirectories

        RepositorySystemSession.SessionBuilder withLocalRepositoryBaseDirectories​(java.util.Collection<java.nio.file.Path> baseDirectories)
        Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null Path present in passed in list. In case multiple files, session builder will use chained local repository manager.
        Parameters:
        baseDirectories - The local repository base directories.
        Returns:
        This session for chaining, never null.
        See Also:
        withLocalRepositories(Collection)
      • withLocalRepositories

        RepositorySystemSession.SessionBuilder withLocalRepositories​(LocalRepository... localRepositories)
        Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null LocalRepository passed in this method. In case multiple local repositories, session builder will use chained local repository manager.
        Parameters:
        localRepositories - The local repositories.
        Returns:
        This session for chaining, never null.
      • withLocalRepositories

        RepositorySystemSession.SessionBuilder withLocalRepositories​(java.util.Collection<LocalRepository> localRepositories)
        Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null LocalRepository present in passed in list. In case multiple local repositories, session builder will use chained local repository manager.
        Parameters:
        localRepositories - The local repositories.
        Returns:
        This session for chaining, never null.