Examples of RepositoryUrl


Examples of com.gitblit.models.RepositoryUrl

    List<RepositoryUrl> list = new ArrayList<RepositoryUrl>();
    // http/https url
    if (settings.getBoolean(Keys.git.enableGitServlet, true)) {
      AccessPermission permission = user.getRepositoryPermission(repository).permission;
      if (permission.exceeds(AccessPermission.NONE)) {
        list.add(new RepositoryUrl(getRepositoryUrl(request, username, repository), permission));
      }
    }

    // add all other urls
    // {0} = repository
    // {1} = username
    for (String url : settings.getStrings(Keys.web.otherUrls)) {
      if (url.contains("{1}")) {
        // external url requires username, only add url IF we have one
        if (!StringUtils.isEmpty(username)) {
          list.add(new RepositoryUrl(MessageFormat.format(url, repository.name, username), null));
        }
      } else {
        // external url does not require username
        list.add(new RepositoryUrl(MessageFormat.format(url, repository.name), null));
      }
    }
    return list;
  }
View Full Code Here

Examples of com.gitblit.models.RepositoryUrl

      user = UserModel.ANONYMOUS;
    }

    HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
    List<RepositoryUrl> repositoryUrls = app().gitblit().getRepositoryUrls(req, user, repository);
    RepositoryUrl primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0);
    String url = primaryUrl != null ? primaryUrl.url : "";

    add(new Label("repository", repositoryName));
    add(new RepositoryUrlPanel("pushurl", false, user, repository));
    add(new Label("cloneSyntax", MessageFormat.format("git clone {0}", url)));
View Full Code Here

Examples of com.gitblit.models.RepositoryUrl

    /*
     *  PATCHSET TAB
     */
    if (currentPatchset == null) {
      // no patchset available
      RepositoryUrl repoUrl = getRepositoryUrl(user, repository);
      boolean canPropose = repoUrl != null && repoUrl.permission.atLeast(AccessPermission.CLONE) && !UserModel.ANONYMOUS.equals(user);
      if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository) && canPropose) {
        // ticket & repo will accept a proposal patchset
        // show the instructions for proposing a patchset
        Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
View Full Code Here

Examples of com.gitblit.models.RepositoryUrl

    HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
    List<RepositoryUrl> urls = app().gitblit().getRepositoryUrls(req, user, repository);
    if (ArrayUtils.isEmpty(urls)) {
      return null;
    }
    RepositoryUrl primary = urls.get(0);
    return primary;
  }
View Full Code Here

Examples of com.gitblit.models.RepositoryUrl

        if (permission.atLeast(AccessPermission.PUSH) && !acceptPush(transport)) {
          // downgrade the repo permission for this transport
          // because it is not an acceptable PUSH transport
          permission = AccessPermission.CLONE;
        }
        list.add(new RepositoryUrl(getRepositoryUrl(request, username, repository), permission));
      }
    }

    // ssh daemon url
    String sshDaemonUrl = servicesManager.getSshDaemonUrl(request, user, repository);
    if (!StringUtils.isEmpty(sshDaemonUrl)) {
      AccessPermission permission = user.getRepositoryPermission(repository).permission;
      if (permission.exceeds(AccessPermission.NONE)) {
        if (permission.atLeast(AccessPermission.PUSH) && !acceptPush(Transport.SSH)) {
          // downgrade the repo permission for this transport
          // because it is not an acceptable PUSH transport
          permission = AccessPermission.CLONE;
        }

        list.add(new RepositoryUrl(sshDaemonUrl, permission));
      }
    }

    // git daemon url
    String gitDaemonUrl = servicesManager.getGitDaemonUrl(request, user, repository);
    if (!StringUtils.isEmpty(gitDaemonUrl)) {
      AccessPermission permission = servicesManager.getGitDaemonAccessPermission(user, repository);
      if (permission.exceeds(AccessPermission.NONE)) {
        if (permission.atLeast(AccessPermission.PUSH) && !acceptPush(Transport.GIT)) {
          // downgrade the repo permission for this transport
          // because it is not an acceptable PUSH transport
          permission = AccessPermission.CLONE;
        }
        list.add(new RepositoryUrl(gitDaemonUrl, permission));
      }
    }

    // add all other urls
    // {0} = repository
    // {1} = username
    for (String url : settings.getStrings(Keys.web.otherUrls)) {
      if (url.contains("{1}")) {
        // external url requires username, only add url IF we have one
        if (!StringUtils.isEmpty(username)) {
          list.add(new RepositoryUrl(MessageFormat.format(url, repository.name, username), null));
        }
      } else {
        // external url does not require username
        list.add(new RepositoryUrl(MessageFormat.format(url, repository.name), null));
      }
    }

    // sort transports by highest permission and then by transport security
    Collections.sort(list, new Comparator<RepositoryUrl>() {
View Full Code Here

Examples of org.apache.archiva.model.RepositoryURL

        return repository;
    }

    public RepositoryURL getURL()
    {
        return new RepositoryURL( repository.getUrl() );
    }
View Full Code Here

Examples of org.apache.archiva.model.RepositoryURL

    }

    public RepositoryURL toURL( ArtifactReference reference )
    {
        String url = repository.getUrl() + toPath( reference );
        return new RepositoryURL( url );
    }
View Full Code Here

Examples of org.apache.archiva.model.RepositoryURL

    extends TestCase
{
    private void assertURL( String actualURL, String protocol, String username, String password, String hostname,
                            String port, String path )
    {
        RepositoryURL url = new RepositoryURL( actualURL );

        assertEquals( protocol, url.getProtocol() );
        assertEquals( username, url.getUsername() );
        assertEquals( password, url.getPassword() );
        assertEquals( hostname, url.getHost() );
        assertEquals( port, url.getPort() );
        assertEquals( path, url.getPath() );
    }
View Full Code Here

Examples of org.apache.archiva.model.RepositoryURL

        return repository;
    }

    public RepositoryURL getURL()
    {
        return new RepositoryURL( repository.getUrl() );
    }
View Full Code Here

Examples of org.apache.archiva.model.RepositoryURL

    }

    public RepositoryURL toURL( ArtifactReference reference )
    {
        String url = repository.getUrl() + toPath( reference );
        return new RepositoryURL( url );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.