View Javadoc

1   /*
2    StatCVS - CVS statistics generation
3    Copyright (C) 2006 Benoit Xhenseval
4   
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9   
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14  
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  
19   */
20  package net.sf.statcvs.output;
21  
22  import java.util.Set;
23  
24  import net.sf.statcvs.model.Directory;
25  import net.sf.statcvs.model.Revision;
26  import net.sf.statcvs.model.VersionedFile;
27  
28  public class TracIntegration implements WebRepositoryIntegration {
29  
30      private String baseUrl;
31  
32      public TracIntegration(final String baseURL) {
33          if (baseURL.endsWith("/")) {
34              baseUrl = baseURL.substring(0, baseURL.length() - 1);
35          } else {
36              baseUrl = baseURL;
37          }
38      }
39  
40      public String getName() {
41          return "Trac";
42      }
43  
44      public String getDirectoryUrl(final Directory directory) {
45          return baseUrl + "/browser/" + directory.getPath();
46      }
47  
48      public String getFileHistoryUrl(final VersionedFile file) {
49          return baseUrl + "/log/" + file.getFilenameWithPath();
50      }
51  
52      public String getFileViewUrl(final Revision revision) {
53          return baseUrl + "/browser/" + revision.getFile().getFilenameWithPath() + "?rev=" + revision.getRevisionNumber();
54      }
55  
56      public String getBaseUrl() {
57          return baseUrl;
58      }
59  
60      public String getDiffUrl(final Revision oldRevision, final Revision newRevision) {
61          return baseUrl + "/changeset?" + "old=" + oldRevision.getRevisionNumber() + "@" + oldRevision.getFile().getFilenameWithPath() + "&new="
62                  + newRevision.getRevisionNumber() + "@" + newRevision.getFile().getFilenameWithPath();
63      }
64  
65      public String getFileViewUrl(final VersionedFile file) {
66          return baseUrl + "/browser/" + file.getFilenameWithPath();
67      }
68  
69      public void setAtticFileNames(final Set atticFileNames) {
70          // Doing nothing ...
71      }
72  
73  }