Find the Ceylon repository path from the alias.

@param repoAlias The Ceylon repository alias
@return File The file representing the path to the repo
436877
File findRepoPath(final String repoAlias) {
        if ("user".equals(repoAlias)) {
            return new File(System.getProperty("user.home") 
                + CeylonUtil.PATH_SEPARATOR 
                + ".ceylon/repo");
        } else if ("cache".equals(repoAlias)) {
            return new File(System.getProperty("user.home") 
                + CeylonUtil.PATH_SEPARATOR 
                + ".ceylon/cache");            
        } else if ("system".equals(repoAlias)) {
            throw new IllegalArgumentException("Ceylon Repository 'system' should not be written to");
        } else if ("remote".equals(repoAlias)) {
            throw new IllegalArgumentException("Ceylon Repository 'remote' should use the ceylon:deploy Maven goal");
        } else if ("local".equals(repoAlias)) {
            return new File(project.getBasedir(), "modules");
        } else {
            throw new IllegalArgumentException(
                "Property ceylonRepository must one of 'user', 'cache' or 'local'. Defaults to 'user'");
        }  
    }
316812
public static RepositoryId getRepository(final MavenProject project,
			final String owner, final String name) {
		// Use owner and name if specified
		if (!StringUtils.isEmpty(owner, name))
			return RepositoryId.create(owner, name);

		if (project == null)
			return null;

		RepositoryId repo = null;
		// Extract repository from SCM URLs first if present
		final Scm scm = project.getScm();
		if (scm != null) {
			repo = RepositoryId.createFromUrl(scm.getUrl());
			if (repo == null)
				repo = extractRepositoryFromScmUrl(scm.getConnection());
			if (repo == null)
				repo = extractRepositoryFromScmUrl(scm.getDeveloperConnection());
		}

		// Check project URL last
		if (repo == null)
			repo = RepositoryId.createFromUrl(project.getUrl());

		return repo;
	}
827844
public ConnectionRepository readConnectionRepository(InputStream inst)
    {
        try
        {
            RepositoryPersistor persistor = new RepositoryPersistor();
            return persistor.readConnectionRepository(inst);
        }
        catch (Exception e)
        {
            throw new MetadataException("Can not read repository from " + inst, e);
        }
    }
1325443
File downloadFromRemoteRepository(ArtifactCoordinates artifactCoordinates, String packaging, Path artifactDirectory) {
        String artifactRelativeHttpPath = toGradleArtifactPath(artifactCoordinates);
        String artifactRelativeMetadataHttpPath = artifactCoordinates.relativeMetadataPath('/');
        for (String remoteRepos : remoteRepositories) {
            String artifactAbsoluteHttpPath = remoteRepos + artifactRelativeHttpPath + ".";
            File targetArtifactPomDirectory = artifactDirectory.resolve(computeGradleUUID(artifactCoordinates + ":pom")).toFile();
            File targetArtifactDirectory = artifactDirectory.resolve(computeGradleUUID(artifactCoordinates + ":" + packaging)).toFile();

            File artifactFile = doDownload(remoteRepos, artifactAbsoluteHttpPath, artifactRelativeHttpPath, artifactCoordinates, packaging, targetArtifactPomDirectory, targetArtifactDirectory);
            if (artifactFile != null) {
                return artifactFile; // Success
            }

            //Try to doDownload the snapshot version
            if (artifactCoordinates.isSnapshot()) {
                String remoteMetadataPath = remoteRepos + artifactRelativeMetadataHttpPath;
                try {
                    String timestamp = MavenArtifactUtil.downloadTimestampVersion(artifactCoordinates + ":" + packaging, remoteMetadataPath);

                    String timestampedArtifactRelativePath = artifactCoordinates.relativeArtifactPath('/', timestamp);
                    String artifactTimestampedAbsoluteHttpPath = remoteRepos + timestampedArtifactRelativePath + ".";
                    File targetTimestampedArtifactPomDirectory = artifactDirectory.resolve(computeGradleUUID(artifactCoordinates + ":" + timestamp + ":pom")).toFile();
                    File targetTimestampedArtifactDirectory = artifactDirectory.resolve(computeGradleUUID(artifactCoordinates + ":" + packaging)).toFile();

                    File snapshotArtifactFile = doDownload(remoteRepos, artifactTimestampedAbsoluteHttpPath, timestampedArtifactRelativePath, artifactCoordinates, packaging, targetTimestampedArtifactPomDirectory, targetTimestampedArtifactDirectory);
                    if (snapshotArtifactFile != null) {
                        return snapshotArtifactFile; //Success
                    }
                } catch (XPathExpressionException | IOException ex) {
                    Module.getModuleLogger().trace(ex, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos);
                    // try next one
                }
            }
        }
        return null;
    }
439146
def get_image_uri(region_name, repo_name, repo_version=1):
    """"""
    repo = '{}:{}'.format(repo_name, repo_version)
    return '{}/{}'.format(registry(region_name, repo_name), repo)
577795
@GET
    @Path("/repositorysummaries")
    public List<RepositorySummary> getRepositorySummaries() {
        List<RepositorySummary> result = new ArrayList<RepositorySummary>(repositories.size());
        for (String repositoryId : repositories.keySet()) {
            RepositorySummary repositorySummary = getScriptRepo(repositoryId).getRepositorySummary();
            result.add(repositorySummary);
        }
        return result;
    }
685916
public static JSONArray getRepositoryNames() {
        final JSONArray ret = new JSONArray();

        if (null == repositoriesDescription) {
            LOGGER.log(Level.INFO, "Not found repository description[repository.json] file under classpath");

            return ret;
        }

        final JSONArray repositories = repositoriesDescription.optJSONArray("repositories");

        for (int i = 0; i < repositories.length(); i++) {
            final JSONObject repository = repositories.optJSONObject(i);

            ret.put(repository.optString("name"));
        }

        return ret;
    }
343892
@Override
    protected File cloneRepository(File dest) {
        BaseRepository repo = Repository.clone(RepositoryConfiguration.DEFAULT, dest, getUrl());

        // set branch name
        String branchName = MASTER;;
        String branch = getBranch();
        if (StringUtils.isNotBlank(branch)) {
            branchName = branch;
        }
        String tag = getTag();
        if (StringUtils.isNotBlank(tag)) {
            branchName = tag;
        }
        BranchCommand.on(repo).set(branchName);
        return dest;
    }
585836
public List<String> getRemoteRepositoryUrls() {
        List<String> urls = new ArrayList<String>();
        for( RemoteRepository repo : getRemoteRepositories() ) {
            urls.add( repo.getUrl() );
        }
        
        return urls;
    }
1320792
private ManageableRepository getRepository(RepositoryService rs) throws ResourceException
   {
      ManageableRepository mRepository = null;
      try
      {
         mRepository = repository == null ? rs.getCurrentRepository() : rs.getRepository(repository);
      }
      catch (Exception e)
      {
         throw new ResourceException("Could not get the "
            + (repository == null ? "current repository." : "repository '" + repository + "'"), e);
      }
      if (mRepository == null)
      {
         throw new ResourceException("Could not find the "
            + (repository == null ? "current repository." : "repository '" + repository + "'"));
      }
      if (LOG.isDebugEnabled())
      {
         LOG.debug("getRepository: repository = " + (repository == null ? "current." : repository));
      }

      return mRepository;
   }
1055814
private List<RemoteRepository> getRemoteRepositories() throws IllegalStateException {
        // disable repositories if working offline
        if (isOffline()) {
            log.log(Level.FINE, "No remote repositories will be available, working in offline mode");
            return Collections.emptyList();
        }
        // the first repository defined is the first where we search
        Set<RemoteRepository> enhancedRepos = new LinkedHashSet<RemoteRepository>();

        // add repositories we defined by hand
        enhancedRepos.addAll(additionalRemoteRepositories);

        ProfileSelector selector = new SettingsXmlProfileSelector();
        LogModelProblemCollector problems = new LogModelProblemCollector();
        List<Profile> activeProfiles = selector.getActiveProfiles(MavenConverter.asProfiles(getSettings().getProfiles()),
                new ProfileActivationContext() {

                    @Override
                    public Map<String, String> getUserProperties() {
                        return Collections.emptyMap();
                    }

                    @SuppressWarnings({ "unchecked", "rawtypes" })
                    @Override
                    public Map<String, String> getSystemProperties() {
                        return new HashMap<String, String>((Map) SecurityActions.getProperties());
                    }

                    @Override
                    public File getProjectDirectory() {
                        return new File(SecurityActions.getProperty("user.dir"));
                    }

                    @Override
                    public Map<String, String> getProjectProperties() {
                        // TODO can we put here other values?
                        return Collections.emptyMap();
                    }

                    @Override
                    public List<String> getInactiveProfileIds() {
                        return Collections.emptyList();
                    }

                    @Override
                    public List<String> getActiveProfileIds() {
                        return getSettings().getActiveProfiles();
                    }
                }, problems);

        if (problems.hasSevereFailures()) {
            throw new IllegalStateException("Unable to get active profiles from Maven settings.");
        }

        for (Profile p : activeProfiles) {
            for (Repository repository : p.getRepositories()) {
                RemoteRepository repo = MavenConverter.asRemoteRepository(repository);
                // add remote repository from model only if not overridden by code
                if (!isIdIncluded(additionalRemoteRepositories, repo)) {
                    enhancedRepos.add(repo);
                }
            }
        }

        // add remote repositories
        for (RemoteRepository repo : remoteRepositories) {
            // add remote repository from model only if not overridden by code
            if (!isIdIncluded(additionalRemoteRepositories, repo)) {
                enhancedRepos.add(repo);
            }
        }

        // add maven central if selected but if not overridden by API
        if (useMavenCentralRepository) {
            if (!isIdIncluded(additionalRemoteRepositories, MAVEN_CENTRAL)) {
                enhancedRepos.add(MAVEN_CENTRAL);
            }
        } else {
            List<RemoteRepository> reposToRemove = new ArrayList<RemoteRepository>();
            // Attempt a remove

            for (final RemoteRepository repo : enhancedRepos) {
                // Because there are a lot of aliases for Maven Central, we have to approximate that anything named
                // "central" with URL containing "maven" is what we're looking to ban. For instance Central could be
                // http://repo.maven.apache.org/maven2 or http://repo1.maven.org/maven2
                final String repoUrl = repo.getUrl();
                if ((repoUrl.contains("maven.org") || repoUrl.contains("apache.org"))
                        && repo.getId().equalsIgnoreCase(MAVEN_CENTRAL_NAME)) {
                    // remote this "might-be" central repository, but only if not specified by hand
                    if (!isIdIncluded(additionalRemoteRepositories, MAVEN_CENTRAL)) {
                        reposToRemove.add(repo);
                    }
                }
            }
            // We have to search on URL criteria, because .equals on RemoteRepository is too strict for us to call a
            // simple remove operation on the enhancedRepos Collection
            enhancedRepos.removeAll(reposToRemove);
        }

        // use mirrors if any to do the mirroring stuff
        DefaultMirrorSelector dms = new DefaultMirrorSelector();
        // fill in mirrors
        for (Mirror mirror : getSettings().getMirrors()) {
            // Repository manager flag is set to false
            // Maven does not support specifying it in the settings.xml
            dms.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
                    mirror.getMirrorOfLayouts());
        }

        Set<RemoteRepository> mirroredRepos = new LinkedHashSet<RemoteRepository>();
        for (RemoteRepository repository : enhancedRepos) {
            RemoteRepository mirror = dms.getMirror(repository);
            if (mirror != null) {
                mirroredRepos.add(mirror);
            } else {
                mirroredRepos.add(repository);
            }
        }

        final Set<RemoteRepository> authorizedRepos = new LinkedHashSet<RemoteRepository>();
        for (RemoteRepository remoteRepository : mirroredRepos) {
            final RemoteRepository.Builder builder = new RemoteRepository.Builder(remoteRepository);

            // add authentication if <server> was provided in settings.xml file
            Server server = getSettings().getServer(remoteRepository.getId());
            if (server != null) {
                final AuthenticationBuilder authenticationBuilder = new AuthenticationBuilder()
                        .addUsername(server.getUsername())
                        .addPassword(server.getPassword())
                        .addPrivateKey(server.getPrivateKey(), server.getPassphrase());
                builder.setAuthentication(authenticationBuilder.build());
            }

            authorizedRepos.add(builder.build());
        }

        if (log.isLoggable(Level.FINER)) {
            for (RemoteRepository repository : authorizedRepos) {
                log.finer("Repository " + repository.getUrl() + " have been made available for artifact resolution");
            }
        }

        return new ArrayList<RemoteRepository>(authorizedRepos);
    }
606876
public Repository getRepository(String instanceId) throws WIMException {
        RepositoryWrapper repositoryHolder = repositories.get(instanceId);
        if (repositoryHolder != null) {
            return repositoryHolder.getRepository();
        }
        return null;
    }
90881
function resolveGitRoot(filepath) {
    var relativeToGit, repoId;

    // No git repo cloned, or file is not in a git repository
    if (!GIT_TMP || !pathUtil.isInRoot(GIT_TMP, filepath)) return null;

    // Extract first directory (is the repo id)
    relativeToGit = path.relative(GIT_TMP, filepath);
    repoId = _.first(relativeToGit.split(path.sep));
    if (!repoId) return;

    // Return an absolute file
    return path.resolve(GIT_TMP, repoId);
}
507424
public CompletableFuture<RepositoryMetadata> getRepo(String projectName, String repoName) {
        requireNonNull(projectName, "projectName");
        requireNonNull(repoName, "repoName");

        return getProject(projectName).thenApply(project -> project.repo(repoName));
    }
398623
@Override
    public File findArtifact(final Artifact artifact) {
        String type = artifact.getProperty("type", "jar");
        if ("ceylon-jar".equals(type) || "car".equals(type)) {
            if ("ceylon-jar".equals(type)) {
                type = "jar";
            }

            File art = new File(CeylonUtil.ceylonSystemFullPath(artifact, type));
            
            if (art.isFile()) {
            	 if (logger != null) {
            		 logger.info("Resolved from Ceylon repo: " + artifact);
            	 }
                artifact.setFile(art);
                return art;
            }
        } 
        return null;
    }
708304
async function getFile(repoId, repository, filePath, branchName) {
  logger.trace(`getFile(filePath=${filePath}, branchName=${branchName})`);
  const azureApiGit = await azureApi.gitApi();
  const item = await azureApiGit.getItemText(
    repoId,
    filePath,
    null,
    null,
    0, // because we look for 1 file
    false,
    false,
    true,
    {
      versionType: 0, // branch
      versionOptions: 0,
      version: getBranchNameWithoutRefsheadsPrefix(branchName),
    }
  );

  if (item && item.readable) {
    const fileContent = await streamToString(item);
    try {
      const jTmp = JSON.parse(fileContent);
      if (jTmp.typeKey === 'GitItemNotFoundException') {
        // file not found
        return null;
      }
      if (jTmp.typeKey === 'GitUnresolvableToCommitException') {
        // branch not found
        return null;
      }
    } catch (error) {
      // it 's not a JSON, so I send the content directly with the line under
    }
    return fileContent;
  }
  return null; // no file found
}
507558
protected String getRepositoryName(String repoName) throws RepositoryException
   {
      // To be cloud compliant we need now to ignore the provided repository name (more details in JCR-2138)
      ManageableRepository repo = repositoryService.getCurrentRepository();
      String currentRepositoryName = repo.getConfiguration().getName();
      if (PropertyManager.isDevelopping() && log.isWarnEnabled())
      {
         if (!currentRepositoryName.equals(repoName))
         {
            log.warn("The expected repository was '" + repoName
               + "' but we will use the current repository instead which is '" + currentRepositoryName + "'");
         }
      }
      return currentRepositoryName;
   }