use of org.commonjava.indy.model.core.ArtifactStore.TRACKING_ID in project indy by Commonjava.
the class ProxyResponseHelper method doGetArtifactStore.
private ArtifactStore doGetArtifactStore(String trackingId, final URL url) throws IndyDataException {
int port = getPort(url);
if (trackingId != null) {
String groupName = repoCreator.formatId(url.getHost(), port, 0, trackingId, StoreType.group);
ArtifactStoreQuery<Group> query = storeManager.query().storeType(Group.class);
Group group = query.getGroup(GENERIC_PKG_KEY, groupName);
logger.debug("Get httproxy group, group: {}", group);
if (group == null) {
logger.debug("Creating repositories (group, hosted, remote) for HTTProx request: {}, trackingId: {}", url, trackingId);
ProxyCreationResult result = createRepo(trackingId, url, null);
group = result.getGroup();
}
return group;
} else {
RemoteRepository remote;
final String baseUrl = getBaseUrl(url, false);
ArtifactStoreQuery<RemoteRepository> query = storeManager.query().storeType(RemoteRepository.class);
remote = query.getAllRemoteRepositories(GENERIC_PKG_KEY).stream().filter(store -> store.getUrl().equals(baseUrl) && store.getMetadata(TRACKING_ID) == null).findFirst().orElse(null);
logger.debug("Get httproxy remote, remote: {}", remote);
if (remote == null) {
logger.debug("Creating remote repository for HTTProx request: {}", url);
String name = getRemoteRepositoryName(url);
ProxyCreationResult result = createRepo(null, url, name);
remote = result.getRemote();
}
return remote;
}
}
Aggregations