hu.midori.kosmos.server.svn
Class SvnServiceImpl

java.lang.Object
  extended by hu.midori.kosmos.server.AbstractKosmosService
      extended by hu.midori.kosmos.server.svn.SvnServiceImpl
All Implemented Interfaces:
SvnService, TimestampedService, org.springframework.context.ApplicationContextAware

public class SvnServiceImpl
extends AbstractKosmosService
implements SvnService

Implementation of the Subversion service.

Uses the JavaSVN library to access the repository.

Version:
$Id$
Author:
Aron Gombas

Field Summary
 
Fields inherited from class hu.midori.kosmos.server.AbstractKosmosService
applicationContext, MAX_LIST_SIZE
 
Constructor Summary
SvnServiceImpl()
           
 
Method Summary
protected  hu.midori.kosmos.server.svn.SvnRepositoryContentStats analyzeContent(org.tmatesoft.svn.core.io.SVNRepository repository)
          Analyzes the repository content and returns its stats.
protected  hu.midori.kosmos.server.svn.SvnRepositoryLogStats analyzeLog(org.tmatesoft.svn.core.io.SVNRepository repository)
          Analyzes the log of the repo and returns its stats.
protected  org.tmatesoft.svn.core.io.SVNRepository connect(java.lang.String url)
          Connects to the given public or secure SVN URL.
protected  void disconnect(org.tmatesoft.svn.core.io.SVNRepository repo)
          Disconnects from the given repository.
protected  void generateCharts(org.tmatesoft.svn.core.io.SVNRepository repository, hu.midori.kosmos.server.svn.SvnRepositoryLogStats logStats, hu.midori.kosmos.server.svn.SvnRepositoryContentStats contentStats)
          Generates and saves the chart images on the server, and sets the URLs to the stats.
 java.util.List<SvnRepository> getRepositories(java.lang.String url)
          Returns the repository on the given URL.
protected  SvnRepository lookupLevel2Cache(java.lang.String url)
          Returns the repository from the "level 2 cache" if the latest revision didn't change.
protected  void traverseRepository(org.tmatesoft.svn.core.io.SVNRepository repository, java.lang.String path, hu.midori.kosmos.server.svn.SvnRepositoryContentStats stats, java.util.Map<java.lang.String,java.lang.Integer> filesPerFileTypeMap)
          Recursively traverses the given SVN repository tree and updates the stats passed.
 
Methods inherited from class hu.midori.kosmos.server.AbstractKosmosService
beginStoreSession, endStoreSession, getResourceString, getTimestamp, setApplicationContext, setStore, storeChart, storeFile, trimList, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hu.midori.kosmos.protocol.TimestampedService
getTimestamp
 

Constructor Detail

SvnServiceImpl

public SvnServiceImpl()
Method Detail

getRepositories

public java.util.List<SvnRepository> getRepositories(java.lang.String url)
Description copied from interface: SvnService
Returns the repository on the given URL.

Specified by:
getRepositories in interface SvnService
Parameters:
url - points to an SVN repository (eg. http://svn.apache.org/repos/asf/ant).
Returns:
a list with a single item.

connect

protected org.tmatesoft.svn.core.io.SVNRepository connect(java.lang.String url)
                                                   throws java.net.MalformedURLException,
                                                          org.tmatesoft.svn.core.SVNException
Connects to the given public or secure SVN URL.

Returns:
the repository after a successful connection.
Throws:
java.net.MalformedURLException
org.tmatesoft.svn.core.SVNException

disconnect

protected void disconnect(org.tmatesoft.svn.core.io.SVNRepository repo)
Disconnects from the given repository.


lookupLevel2Cache

protected SvnRepository lookupLevel2Cache(java.lang.String url)
Returns the repository from the "level 2 cache" if the latest revision didn't change.


analyzeLog

protected hu.midori.kosmos.server.svn.SvnRepositoryLogStats analyzeLog(org.tmatesoft.svn.core.io.SVNRepository repository)
                                                                throws org.tmatesoft.svn.core.SVNException
Analyzes the log of the repo and returns its stats.

Throws:
org.tmatesoft.svn.core.SVNException

analyzeContent

protected hu.midori.kosmos.server.svn.SvnRepositoryContentStats analyzeContent(org.tmatesoft.svn.core.io.SVNRepository repository)
                                                                        throws org.tmatesoft.svn.core.SVNException
Analyzes the repository content and returns its stats.

Throws:
org.tmatesoft.svn.core.SVNException

traverseRepository

protected void traverseRepository(org.tmatesoft.svn.core.io.SVNRepository repository,
                                  java.lang.String path,
                                  hu.midori.kosmos.server.svn.SvnRepositoryContentStats stats,
                                  java.util.Map<java.lang.String,java.lang.Integer> filesPerFileTypeMap)
                           throws org.tmatesoft.svn.core.SVNException
Recursively traverses the given SVN repository tree and updates the stats passed.

Throws:
org.tmatesoft.svn.core.SVNException

generateCharts

protected void generateCharts(org.tmatesoft.svn.core.io.SVNRepository repository,
                              hu.midori.kosmos.server.svn.SvnRepositoryLogStats logStats,
                              hu.midori.kosmos.server.svn.SvnRepositoryContentStats contentStats)
                       throws java.io.IOException
Generates and saves the chart images on the server, and sets the URLs to the stats.

Throws:
java.io.IOException