/** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { return "DfsRepositoryDescription[" + getRepositoryName() + "]"; } }
/** {@inheritDoc} */ @Override public boolean equals(Object b) { if (b instanceof DfsRepositoryDescription){ String name = getRepositoryName(); String otherName = ((DfsRepositoryDescription) b).getRepositoryName(); return name != null ? name.equals(otherName) : this == b; } return false; }
/** {@inheritDoc} */ @Override public int hashCode() { if (getRepositoryName() != null) return getRepositoryName().hashCode(); return System.identityHashCode(this); }
private static String computeKey(Repository repo) { if (repo instanceof DfsRepository) { DfsRepository dfs = (DfsRepository) repo; return dfs.getDescription().getRepositoryName(); } if (repo.getDirectory() != null) { return repo.getDirectory().toURI().toString(); } throw new IllegalArgumentException(); } }
/** {@inheritDoc} */ @Override public synchronized String createNonce(Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) { path = ((DfsRepository) repo).getDescription().getRepositoryName(); } else { File directory = repo.getDirectory(); if (directory != null) { path = directory.getPath(); } else { throw new IllegalStateException(); } } String input = path + ":" + String.valueOf(timestamp); //$NON-NLS-1$ byte[] rawHmac = mac.doFinal(input.getBytes(UTF_8)); return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$ }
@SuppressWarnings("nls") @Override public String toString() { return "DfsRepositoryDescription[" + getRepositoryName() + "]"; } }
/** {@inheritDoc} */ @SuppressWarnings("nls") @Override public String toString() { return "DfsRepositoryDescription[" + getRepositoryName() + "]"; } }
@Override public boolean equals(Object b) { if (b instanceof DfsRepositoryDescription){ String name = getRepositoryName(); String otherName = ((DfsRepositoryDescription) b).getRepositoryName(); return name != null ? name.equals(otherName) : this == b; } return false; }
/** {@inheritDoc} */ @Override public boolean equals(Object b) { if (b instanceof DfsRepositoryDescription){ String name = getRepositoryName(); String otherName = ((DfsRepositoryDescription) b).getRepositoryName(); return name != null ? name.equals(otherName) : this == b; } return false; }
@Override public int hashCode() { if (getRepositoryName() != null) return getRepositoryName().hashCode(); return System.identityHashCode(this); }
/** {@inheritDoc} */ @Override public int hashCode() { if (getRepositoryName() != null) return getRepositoryName().hashCode(); return System.identityHashCode(this); }
private static String computeKey(Repository repo) { if (repo instanceof DfsRepository) { DfsRepository dfs = (DfsRepository) repo; return dfs.getDescription().getRepositoryName(); } if (repo.getDirectory() != null) { return repo.getDirectory().toURI().toString(); } throw new IllegalArgumentException(); } }
private static String computeKey(Repository repo) { if (repo instanceof DfsRepository) { DfsRepository dfs = (DfsRepository) repo; return dfs.getDescription().getRepositoryName(); } if (repo.getDirectory() != null) { return repo.getDirectory().toURI().toString(); } throw new IllegalArgumentException(); } }
/** {@inheritDoc} */ @Override public synchronized String createNonce(Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) { path = ((DfsRepository) repo).getDescription().getRepositoryName(); } else { File directory = repo.getDirectory(); if (directory != null) { path = directory.getPath(); } else { throw new IllegalStateException(); } } String input = path + ":" + String.valueOf(timestamp); //$NON-NLS-1$ byte[] rawHmac = mac.doFinal(input.getBytes(UTF_8)); return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$ }
public synchronized String createNonce(Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) { path = ((DfsRepository) repo).getDescription().getRepositoryName(); } else { File directory = repo.getDirectory(); if (directory != null) { path = directory.getPath(); } else { throw new IllegalStateException(); } } String input = path + ":" + String.valueOf(timestamp); //$NON-NLS-1$ byte[] rawHmac; try { rawHmac = mac.doFinal(input.getBytes("UTF-8")); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } return Long.toString(timestamp) + "-" + toHex(rawHmac); //$NON-NLS-1$ }
static String identify(Repository git) { if (git instanceof DfsRepository) { return ((DfsRepository) git).getDescription().getRepositoryName(); } else if (git.getDirectory() != null) { return git.getDirectory().getPath(); } return "unknown"; }