@Override
public StrategyResult doDiscover(final MavenProxyRepository mavenProxyRepository) throws StrategyFailedException,
IOException
{
StorageFileItem item;
String path = config.getRemotePrefixFilePath();
log.debug("Looking for remote prefix on {} at path {}", mavenProxyRepository, path);
// we keep exclusive lock on UID during discovery to prevent other threads grabbing this file
// prematurely. We release the lock only when file is present locally, and is validated.
// in that moment it's not published yet, but the content is correct and it will be
// the same that will get published.
final RepositoryItemUid uid = mavenProxyRepository.createUid(path);
uid.getLock().lock(Action.update);
try {
item = retrieveFromRemoteIfExists(mavenProxyRepository, path);
if (item != null) {
log.debug("Remote prefix on {} at path {} found!", mavenProxyRepository, path);
long prefixFileAgeInDays = (System.currentTimeMillis() - item.getModified()) / 86400000L;
Result unmarshalled = new TextFilePrefixSourceMarshaller(config).read(item);
if (!unmarshalled.supported()) {
return new StrategyResult("Remote disabled automatic routing", UNSUPPORTED_PREFIXSOURCE, false);
}
if (unmarshalled.entries().isEmpty()) {