| 1 | |
package net.sf.statcvs.output; |
| 2 | |
|
| 3 | |
import java.util.Set; |
| 4 | |
|
| 5 | |
import net.sf.statcvs.model.Directory; |
| 6 | |
import net.sf.statcvs.model.Revision; |
| 7 | |
import net.sf.statcvs.model.VersionedFile; |
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
public class JCVSWebIntegration implements WebRepositoryIntegration { |
| 16 | |
private String baseURL; |
| 17 | |
|
| 18 | 0 | public JCVSWebIntegration(final String baseURL) { |
| 19 | 0 | if (baseURL.endsWith("/")) { |
| 20 | 0 | this.baseURL = baseURL.substring(0, baseURL.length() - 1); |
| 21 | |
} else { |
| 22 | 0 | this.baseURL = baseURL; |
| 23 | |
} |
| 24 | 0 | } |
| 25 | |
|
| 26 | |
public String getName() { |
| 27 | 0 | return "JCVSWeb"; |
| 28 | |
} |
| 29 | |
|
| 30 | |
public String getDirectoryUrl(final Directory directory) { |
| 31 | 0 | final String path = baseURL + "/list/" + directory.getPath(); |
| 32 | 0 | return path; |
| 33 | |
} |
| 34 | |
|
| 35 | |
public String getFileHistoryUrl(final VersionedFile file) { |
| 36 | 0 | return baseURL + "/vers/" + file.getFilenameWithPath(); |
| 37 | |
} |
| 38 | |
|
| 39 | |
public String getFileViewUrl(final VersionedFile file) { |
| 40 | 0 | return baseURL + "/view/" + file.getFilenameWithPath() + "/" + file.getLatestRevision().getRevisionNumber(); |
| 41 | |
} |
| 42 | |
|
| 43 | |
public String getFileViewUrl(final Revision revision) { |
| 44 | 0 | return baseURL + "/view/" + revision.getFile().getFilenameWithPath() + "/" + revision.getRevisionNumber(); |
| 45 | |
} |
| 46 | |
|
| 47 | |
public String getDiffUrl(final Revision oldRevision, final Revision newRevision) { |
| 48 | 0 | return baseURL + "/pdiff/" + newRevision.getFile().getFilenameWithPath() + "/" + oldRevision.getRevisionNumber() + "/" |
| 49 | |
+ newRevision.getRevisionNumber(); |
| 50 | |
} |
| 51 | |
|
| 52 | |
public void setAtticFileNames(final Set atticFileNames) { |
| 53 | |
|
| 54 | 0 | } |
| 55 | |
|
| 56 | |
public String getBaseUrl() { |
| 57 | 0 | return baseURL; |
| 58 | |
} |
| 59 | |
} |