URIish.getPath
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.eclipse.jgit.transport.URIish.getPath (Showing top 20 results out of 315)

  • Common ways to obtain URIish
private void myMethod () {
URIish u =
  • String s;new URIish(s)
  • new URIish()
  • new URIish(SCHEME + "://test/conn" + n)
  • Smart code suggestions by Codota
}
origin: spring-cloud/spring-cloud-config

/**
 * Creates a message digest
 * @param uri
 * @return
 * @throws NoSuchAlgorithmException
 */
private static byte[] canonicalRequestDigest(URIish uri) throws NoSuchAlgorithmException {
  StringBuilder canonicalRequest = new StringBuilder();
  canonicalRequest.append("GIT\n")		// codecommit uses GIT as the request method
    .append(uri.getPath()).append("\n")	// URI request path
    .append("\n")						// Query string, always empty for codecommit
          // Next is canonical headers, codecommit only requires the host header
    .append("host:").append(uri.getHost()).append("\n")
    .append("\n")						// canonical headers are always terminated by newline
    .append("host\n");					// The list of canonical headers, only one for codecommit
  MessageDigest digest = MessageDigest.getInstance(SHA_256);
  
  return digest.digest(canonicalRequest.toString().getBytes());
}

origin: jenkinsci/gitlab-plugin

public static String retrieveProjectId(GitLabClient client, String remoteUrl) throws ProjectIdResolutionException {
  try {
    String baseUri = client.getHostUrl();
    String projectId;
    if (baseUri != null && remoteUrl.startsWith(baseUri)) {
      projectId = new URIish(remoteUrl.substring(baseUri.length())).getPath();
      if (projectId.contains(":")) {
        projectId = projectId.substring(projectId.indexOf(":"));
      } else if (projectId.startsWith(".")) {
        projectId = projectId.substring(projectId.indexOf("/"));
      }
    } else {
      projectId = new URIish(remoteUrl).getPath();
    }
    if (projectId.startsWith(":")) {
      projectId = projectId.substring(1);
    }
    Matcher matcher = PROJECT_ID_PATTERN.matcher(projectId);
    if (matcher.matches()) {
      return matcher.group("projectId");
    } else {
      throw new ProjectIdResolutionException(String.format("Failed to retrieve GitLab projectId for %s", remoteUrl));
    }
  } catch (URISyntaxException e) {
    throw new ProjectIdResolutionException(String.format("Failed to retrieve GitLab projectId for %s", remoteUrl), e);
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

String commandFor(String exe) {
  String path = uri.getPath();
  if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$
    path = (uri.getPath().substring(1));
  final StringBuilder cmd = new StringBuilder();
  cmd.append(exe);
  cmd.append(' ');
  cmd.append(QuotedString.BOURNE.quote(path));
  return cmd.toString();
}
origin: org.eclipse.jgit/org.eclipse.jgit

NoRemoteRepositoryException cleanNotFound(NoRemoteRepositoryException nf,
    String why) {
  if (why == null || why.length() == 0)
    return nf;
  String path = uri.getPath();
  if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$
    path = uri.getPath().substring(1);
  final StringBuilder pfx = new StringBuilder();
  pfx.append("fatal: "); //$NON-NLS-1$
  pfx.append(QuotedString.BOURNE.quote(path));
  pfx.append(": "); //$NON-NLS-1$
  if (why.startsWith(pfx.toString()))
    why = why.substring(pfx.length());
  return new NoRemoteRepositoryException(uri, why);
}
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
public boolean canHandle(URIish uri, Repository local, String remoteName) {
  if (uri.getScheme() == null) {
    // scp-style URI "host:path" does not have scheme.
    return uri.getHost() != null
      && uri.getPath() != null
      && uri.getHost().length() != 0
      && uri.getPath().length() != 0;
  }
  return super.canHandle(uri, local, remoteName);
}
origin: org.eclipse.jgit/org.eclipse.jgit

TransportAmazonS3(final Repository local, final URIish uri)
    throws NotSupportedException {
  super(local, uri);
  Properties props = loadProperties();
  File directory = local.getDirectory();
  if (!props.containsKey("tmpdir") && directory != null) //$NON-NLS-1$
    props.put("tmpdir", directory.getPath()); //$NON-NLS-1$
  s3 = new AmazonS3(props);
  bucket = uri.getHost();
  String p = uri.getPath();
  if (p.startsWith("/")) //$NON-NLS-1$
    p = p.substring(1);
  if (p.endsWith("/")) //$NON-NLS-1$
    p = p.substring(0, p.length() - 1);
  keyPrefix = p;
}
origin: org.eclipse.jgit/org.eclipse.jgit

void service(String name, PacketLineOut pckOut)
    throws IOException {
  final StringBuilder cmd = new StringBuilder();
  cmd.append(name);
  cmd.append(' ');
  cmd.append(uri.getPath());
  cmd.append('\0');
  cmd.append("host="); //$NON-NLS-1$
  cmd.append(uri.getHost());
  if (uri.getPort() > 0 && uri.getPort() != GIT_PORT) {
    cmd.append(":"); //$NON-NLS-1$
    cmd.append(uri.getPort());
  }
  cmd.append('\0');
  pckOut.writeString(cmd.toString());
  pckOut.flush();
}
origin: org.eclipse.jgit/org.eclipse.jgit

String s = getPath();
if ("/".equals(s) || "".equals(s)) //$NON-NLS-1$ //$NON-NLS-2$
  s = getHost();
origin: org.eclipse.jgit/org.eclipse.jgit

  @Override
  public Transport open(URIish uri) throws NotSupportedException,
      TransportException {
    if ("bundle".equals(uri.getScheme())) { //$NON-NLS-1$
      File path = FS.DETECTED.resolve(new File("."), uri.getPath()); //$NON-NLS-1$
      return new TransportBundleFile(uri, path);
    }
    return TransportLocal.PROTO_LOCAL.open(uri);
  }
};
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
public Transport open(URIish uri, Repository local, String remoteName)
    throws NotSupportedException, TransportException {
  if ("bundle".equals(uri.getScheme())) { //$NON-NLS-1$
    File path = FS.DETECTED.resolve(new File("."), uri.getPath()); //$NON-NLS-1$
    return new TransportBundleFile(local, uri, path);
  }
  // This is an ambiguous reference, it could be a bundle file
  // or it could be a Git repository. Allow TransportLocal to
  // resolve the path and figure out which type it is by testing
  // the target.
  //
  return TransportLocal.PROTO_LOCAL.open(uri, local, remoteName);
}
origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public int hashCode() {
  int hc = 0;
  if (getScheme() != null)
    hc = hc * 31 + getScheme().hashCode();
  if (getUser() != null)
    hc = hc * 31 + getUser().hashCode();
  if (getPass() != null)
    hc = hc * 31 + getPass().hashCode();
  if (getHost() != null)
    hc = hc * 31 + getHost().hashCode();
  if (getPort() > 0)
    hc = hc * 31 + getPort();
  if (getPath() != null)
    hc = hc * 31 + getPath().hashCode();
  return hc;
}
origin: org.eclipse.jgit/org.eclipse.jgit

if (getPath() != null) {
  if (getScheme() != null) {
    if (!getPath().startsWith("/") && !getPath().isEmpty()) //$NON-NLS-1$
      r.append('/');
  } else if (getHost() != null)
  if (getScheme() != null)
    if (escapeNonAscii)
      r.append(escape(getPath(), false, escapeNonAscii));
    else
      r.append(getRawPath());
  else
    r.append(getPath());
origin: org.eclipse.jgit/org.eclipse.jgit

  @Override
  public Transport open(URIish uri) throws NotSupportedException,
      TransportException {
    File path = FS.DETECTED.resolve(new File("."), uri.getPath()); //$NON-NLS-1$
    // If the reference is to a local file, C Git behavior says
    // assume this is a bundle, since repositories are directories.
    if (path.isFile())
      return new TransportBundleFile(uri, path);
    File gitDir = RepositoryCache.FileKey.resolve(path, FS.DETECTED);
    if (gitDir == null)
      throw new NoRemoteRepositoryException(uri,
          JGitText.get().notFound);
    return new TransportLocal(uri, gitDir);
  }
};
origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public PushConnection openPush() throws TransportException {
  final SftpObjectDB c = new SftpObjectDB(uri.getPath());
  final WalkPushConnection r = new WalkPushConnection(this, c);
  r.available(c.readAdvertisedRefs());
  return r;
}
origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public FetchConnection openFetch() throws TransportException {
  final SftpObjectDB c = new SftpObjectDB(uri.getPath());
  final WalkFetchConnection r = new WalkFetchConnection(this, c);
  r.available(c.readAdvertisedRefs());
  return r;
}
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
public boolean canHandle(URIish uri, Repository local, String remoteName) {
  if (uri.getPath() == null
      || uri.getPort() > 0
      || uri.getUser() != null
      || uri.getPass() != null
      || uri.getHost() != null
      || (uri.getScheme() != null && !getSchemes().contains(uri.getScheme())))
    return false;
  return true;
}
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
public boolean canHandle(URIish uri, Repository local, String remoteName) {
  if (uri.getPath() == null
      || uri.getPort() > 0
      || uri.getUser() != null
      || uri.getPass() != null
      || uri.getHost() != null
      || (uri.getScheme() != null && !getSchemes().contains(uri.getScheme())))
    return false;
  return true;
}
origin: org.eclipse.jgit/org.eclipse.jgit

    if (uri.getPath() == null || uri.getPath().length() == 0)
      return false;
    break;
if (uri.getPort() > 0 && !canHave.contains(URIishField.PORT))
  return false;
if (uri.getPath() != null && !canHave.contains(URIishField.PATH))
  return false;
origin: org.eclipse.jgit/org.eclipse.jgit

@Override
public Transport open(URIish uri, Repository local, String remoteName)
    throws NoRemoteRepositoryException {
  File localPath = local.isBare() ? local.getDirectory() : local.getWorkTree();
  File path = local.getFS().resolve(localPath, uri.getPath());
  // If the reference is to a local file, C Git behavior says
  // assume this is a bundle, since repositories are directories.
  if (path.isFile())
    return new TransportBundleFile(local, uri, path);
  File gitDir = RepositoryCache.FileKey.resolve(path, local.getFS());
  if (gitDir == null)
    throw new NoRemoteRepositoryException(uri, JGitText.get().notFound);
  return new TransportLocal(local, uri, gitDir);
}
origin: org.eclipse.jgit/org.eclipse.jgit

/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
  if (!(obj instanceof URIish))
    return false;
  final URIish b = (URIish) obj;
  if (!eq(getScheme(), b.getScheme()))
    return false;
  if (!eq(getUser(), b.getUser()))
    return false;
  if (!eq(getPass(), b.getPass()))
    return false;
  if (!eq(getHost(), b.getHost()))
    return false;
  if (getPort() != b.getPort())
    return false;
  if (!eq(getPath(), b.getPath()))
    return false;
  return true;
}
org.eclipse.jgit.transportURIishgetPath

Javadoc

Get path name component

Popular methods of URIish

  • <init>
  • toString
  • getHost
  • getScheme
  • toPrivateString
    Obtain the string form of the URI, with the password included.
  • getUser
  • getPort
  • setPath
    Return a new URI matching this one, but with a different path.
  • getHumanishName
    Get the "humanish" part of the path. Some examples of a 'humanish' part for a full path:PathHumanish
  • setPort
    Return a new URI matching this one, but with a different port.
  • setScheme
    Return a new URI matching this one, but with a different scheme.
  • setUser
    Return a new URI matching this one, but with a different user.
  • setScheme,
  • setUser,
  • getPass,
  • setHost,
  • setPass,
  • getRawPath,
  • toPrivateASCIIString,
  • cleanLeadingSlashes,
  • eq

Popular in Java

  • Reactive rest calls using spring rest template
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JButton (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)