Class DefaultTranslator

    • Constructor Detail

      • DefaultTranslator

        public DefaultTranslator​(String endpointUrl,
                                 int restMaxSize,
                                 int restMinSize,
                                 String repositoryGroup,
                                 Boolean brewPullActive,
                                 String mode,
                                 String incrementalSerialSuffix,
                                 Map<String,​String> restHeaders,
                                 int restConnectionTimeout,
                                 int restSocketTimeout,
                                 int restRetryDuration)
        Parameters:
        endpointUrl - is the URL to talk to.
        restMaxSize - initial (maximum) size of the rest call; if zero will send everything.
        restMinSize - minimum size for the call
        repositoryGroup - the group to pass to the endpoint, still can be used, but is replaced by brewPullActive flag and mode when used in combination with DA 2.1 and above
        brewPullActive - flag saying if brew pull should be used for version retrieval
        mode - lookup mode, either STANDARD (default if empty) or SERVICE
        incrementalSerialSuffix - the suffix to pass to the endpoint.
        restHeaders - the headers to pass to the endpoint
      • DefaultTranslator

        public DefaultTranslator​(String endpointUrl,
                                 int restMaxSize,
                                 int restMinSize,
                                 String repositoryGroup,
                                 Boolean brewPullActive,
                                 String mode,
                                 String incrementalSerialSuffix,
                                 int restConnectionTimeout,
                                 int restSocketTimeout,
                                 int restRetryDuration)
        Parameters:
        endpointUrl - is the URL to talk to.
        restMaxSize - initial (maximum) size of the rest call; if zero will send everything.
        restMinSize - minimum size for the call
        repositoryGroup - the group to pass to the endpoint.
        brewPullActive - flag saying if brew pull should be used for version retrieval
        mode - lookup mode, either STANDARD (default if empty) or SERVICE
        incrementalSerialSuffix - the suffix to pass to the endpoint.
    • Method Detail

      • translateVersions

        public Map<ProjectVersionRef,​String> translateVersions​(List<ProjectVersionRef> p)
                                                              throws RestException
        Translate the versions.
         [
           {
             "groupId": "com.google.guava",
             "artifactId": "guava",
             "version": "13.0.1"
           }
         ]
         
        This equates to a List of ProjectVersionRef.
         {
             "productNames": [],
             "productVersionIds": [],
             "repositoryGroup": "",
             "gavs": [
               {
                 "groupId": "com.google.guava",
                 "artifactId": "guava",
                 "version": "13.0.1"
               }
             ]
         }
         
        There may be a lot of them, possibly causing timeouts or other issues. This is mitigated by splitting them into smaller chunks when an error occurs and retrying.
        Specified by:
        translateVersions in interface Translator
        Parameters:
        p - - List of projects (GAVs)
        Returns:
        Map of ProjectVersionRef objects as keys and translated versions as values
        Throws:
        RestException - if an error occurs.