View Javadoc

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   * Creates links to a <a href="http://www.jcvs.org/jcvsweb/">JCVSWeb</a> repository browser.
11   * 
12   * @author ERMEANEY
13   * @version $Id: JCVSWebIntegration.java,v 1.3 2008/04/02 11:22:15 benoitx Exp $
14   */
15  public class JCVSWebIntegration implements WebRepositoryIntegration {
16      private String baseURL;
17  
18      public JCVSWebIntegration(final String baseURL) {
19          if (baseURL.endsWith("/")) {
20              this.baseURL = baseURL.substring(0, baseURL.length() - 1);
21          } else {
22              this.baseURL = baseURL;
23          }
24      }
25  
26      public String getName() {
27          return "JCVSWeb";
28      }
29  
30      public String getDirectoryUrl(final Directory directory) {
31          final String path = baseURL + "/list/" + directory.getPath();
32          return path;
33      }
34  
35      public String getFileHistoryUrl(final VersionedFile file) {
36          return baseURL + "/vers/" + file.getFilenameWithPath();
37      }
38  
39      public String getFileViewUrl(final VersionedFile file) {
40          return baseURL + "/view/" + file.getFilenameWithPath() + "/" + file.getLatestRevision().getRevisionNumber();
41      }
42  
43      public String getFileViewUrl(final Revision revision) {
44          return baseURL + "/view/" + revision.getFile().getFilenameWithPath() + "/" + revision.getRevisionNumber();
45      }
46  
47      public String getDiffUrl(final Revision oldRevision, final Revision newRevision) {
48          return baseURL + "/pdiff/" + newRevision.getFile().getFilenameWithPath() + "/" + oldRevision.getRevisionNumber() + "/"
49                  + newRevision.getRevisionNumber();
50      }
51  
52      public void setAtticFileNames(final Set atticFileNames) {
53          // Ignore
54      }
55  
56      public String getBaseUrl() {
57          return baseURL;
58      }
59  }