Package org.commonjava.maven.ext.io.rest
Class DefaultTranslator
- java.lang.Object
-
- org.commonjava.maven.ext.io.rest.DefaultTranslator
-
- All Implemented Interfaces:
Translator
public class DefaultTranslator extends Object implements Translator
-
-
Field Summary
-
Fields inherited from interface org.commonjava.maven.ext.io.rest.Translator
CHUNK_SPLIT_COUNT, DEFAULT_CONNECTION_TIMEOUT_SEC, DEFAULT_SOCKET_TIMEOUT_SEC, RETRY_DURATION_SEC
-
-
Constructor Summary
Constructors Constructor Description DefaultTranslator(String endpointUrl, int restMaxSize, int restMinSize, String repositoryGroup, Boolean brewPullActive, String mode, String incrementalSerialSuffix, int restConnectionTimeout, int restSocketTimeout, int restRetryDuration)
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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ProjectVersionRef>
findBlacklisted(ProjectRef ga)
Map<ProjectVersionRef,String>
translateVersions(List<ProjectVersionRef> p)
Translate the versions.
-
-
-
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 callrepositoryGroup
- 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 abovebrewPullActive
- flag saying if brew pull should be used for version retrievalmode
- lookup mode, either STANDARD (default if empty) or SERVICEincrementalSerialSuffix
- 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 callrepositoryGroup
- the group to pass to the endpoint.brewPullActive
- flag saying if brew pull should be used for version retrievalmode
- lookup mode, either STANDARD (default if empty) or SERVICEincrementalSerialSuffix
- the suffix to pass to the endpoint.
-
-
Method Detail
-
findBlacklisted
public List<ProjectVersionRef> findBlacklisted(ProjectRef ga) throws RestException
- Specified by:
findBlacklisted
in interfaceTranslator
- Throws:
RestException
-
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 interfaceTranslator
- Parameters:
p
- - List of projects (GAVs)- Returns:
- Map of ProjectVersionRef objects as keys and translated versions as values
- Throws:
RestException
- if an error occurs.
-
-