fr.ifremer.isisfish.vcs
Class VCSSVN

java.lang.Object
  extended by fr.ifremer.isisfish.vcs.AbstractVCS
      extended by fr.ifremer.isisfish.vcs.VCSSVN
All Implemented Interfaces:
VCS, FileFilter

public class VCSSVN
extends AbstractVCS

SVN VCS. Based on SVNKit.

Version:
$Revision: 1.0 $ Last update : $Date: 1 déc. 2008 $ By : $Author: chatellier $
Author:
poussin

Nested Class Summary
protected static class VCSSVN.ConnectionState
          Connection state.
 
Nested classes/interfaces inherited from interface fr.ifremer.isisfish.vcs.VCS
VCS.Status
 
Field Summary
protected  VCSSVN.ConnectionState connectionState
          Current connection state.
protected static org.apache.commons.logging.Log log
          to use log facility, just put in your code: log.info(\"...\");
protected  org.tmatesoft.svn.core.wc.SVNClientManager svnManager
          Svn client manager instance.
 
Fields inherited from class fr.ifremer.isisfish.vcs.AbstractVCS
host, listeners, localRepository, login, password, path, protocol, sshKeyFile, writeable
 
Fields inherited from interface fr.ifremer.isisfish.vcs.VCS
TYPE_CVS, TYPE_NONE, TYPE_SVN, VCS_HOST_NAME, VCS_PATH, VCS_PROTOCOL, VCS_TYPE, VCS_USER_NAME, VCS_USER_PASSWORD
 
Constructor Summary
VCSSVN(File localRepository, String protocol, String host, String path, File sshKeyFile, String login, String password)
          Constructor.
 
Method Summary
 void add(List<File> files, String msg)
          Perform : - svn add - commit
 List<File> checkFileStatus()
          Vérifie si tous les fichiers du repository local sont les dernieres version par rapport au serveur.
 void checkout(org.nuiton.util.Version tag, boolean recurse)
          get repository on server and put it in localdir.
 void checkProtocol()
          Verifie la connexion et si le protocole a change, switch le repository pour utiliser le nouveau protocole.
 void cleanup(File path)
          Cleanup a directory, removing all lock.
 void commit(List<File> files, String msg)
          Commit specified files, if files is null, all files are committed.
protected  void commitWithoutCheck(List<File> files, String msg)
          Commit without ask for registred listeners.
 void delete(List<File> files, String msg)
          Delete and commit files in server repository.
 Map<File,String> getChanglog(List<File> files)
          Return all changelog between local file version and remote repository file version.
 String getDiff(File file)
          show diff between local file and repository file.
 List<String> getFileList(File directory)
          Return list of all file on directory on remote server.
 VCS.Status getLocalStatus(File file)
          Get file local status.
protected  Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getLocalStatus(File file, boolean recurse, org.tmatesoft.svn.core.wc.SVNStatusType... wanted)
          Recherche le statut des fichiers locaux, ne retourne jamais les fichiers NORMAL ou NONE sauf si demandé explicitement via wanted
 String getRemoteRepository()
          Retourne l'url du repository distant.
protected  Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getRemoteStatus(File file, boolean recurse, org.tmatesoft.svn.core.wc.SVNStatusType... wanted)
           
protected  org.tmatesoft.svn.core.SVNURL getRemoteURL()
          Retourne l'url dans un objet SVNURL (svnkit).
protected  org.tmatesoft.svn.core.wc.SVNClientManager getSVNManager()
          Return svnkit SVNManager.
 String getTag()
          Retourne le tag reellement utilise, par exemple si on a fait un setTag(3.2.0) cette methode retourne "/tags/3.2.0", pour setTag(null) on retourne "/trunk"
 List<File> getUpdatedFile()
          get list of new or modified files on server.
 boolean haveUpdate()
          Ask if there are some new or modified files on server.
 boolean isConnected()
          Get connection state.
 boolean isOnRemote(File file)
          Check if file is available on server.
 boolean isTag(org.nuiton.util.Version version)
          Look on server if version is tag repository.
 boolean isUpToDate(File file)
          Check if file is uptodate.
 boolean isValidLocalRepository()
          Return true, if local repository is valid repository for actual vcs.
 boolean isVersionnableFile(File file)
          Check if file can be put in vcs repository.
 boolean isWriteable()
          Return true, if local repository is writable.
 List<File> setTag(org.nuiton.util.Version version)
          Change repository tag, used when we use some tag and we want to go to trunk.
 List<File> update(File file, boolean recurse)
          Update file.
 
Methods inherited from class fr.ifremer.isisfish.vcs.AbstractVCS
accept, addVetoableActionListener, fireAction, getHost, getLocalRepository, getLogin, getPassword, getPath, getProtocol, getSshKeyFile, remoteVetoableActionListener, setHost, setLocalRepository, setLogin, setPassword, setPath, setProtocol, setSshKeyFile, setWriteable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
to use log facility, just put in your code: log.info(\"...\");


svnManager

protected org.tmatesoft.svn.core.wc.SVNClientManager svnManager
Svn client manager instance.


connectionState

protected VCSSVN.ConnectionState connectionState
Current connection state.

Constructor Detail

VCSSVN

public VCSSVN(File localRepository,
              String protocol,
              String host,
              String path,
              File sshKeyFile,
              String login,
              String password)
Constructor.

Parameters:
localRepository -
protocol -
host -
path -
sshKeyFile -
login -
password -
Method Detail

getSVNManager

protected org.tmatesoft.svn.core.wc.SVNClientManager getSVNManager()
Return svnkit SVNManager.

Returns:
SVNManager instance
See Also:
SVNClientManager

isValidLocalRepository

public boolean isValidLocalRepository()
Return true, if local repository is valid repository for actual vcs.

Returns:
validity

isConnected

public boolean isConnected()
Get connection state.

Returns:
true if server is connected

checkProtocol

public void checkProtocol()
                   throws VCSException
Verifie la connexion et si le protocole a change, switch le repository pour utiliser le nouveau protocole. Si on est en mode interface (mode graphique) et que le switch se passe mal, demande a l'utilisateur de nouvelle valeur pour le protocole (+ identifiant, ...)

Throws:
VCSException

checkFileStatus

public List<File> checkFileStatus()
                           throws VCSException
Vérifie si tous les fichiers du repository local sont les dernieres version par rapport au serveur. Si ce n'est pas le cas et que l'on est en mode interactif (mode graphique), on lui propose de mettre a jour les fichiers, avec la possibilite de voir les changements sur les fichiers

Returns:
list of file with unresolved conflict
Throws:
VCSException

getRemoteURL

protected org.tmatesoft.svn.core.SVNURL getRemoteURL()
                                              throws org.tmatesoft.svn.core.SVNException
Retourne l'url dans un objet SVNURL (svnkit).

Returns:
l'url distante
Throws:
org.tmatesoft.svn.core.SVNException
See Also:
SVNURL

getRemoteRepository

public String getRemoteRepository()
Retourne l'url du repository distant. ex: ssh+svn://labs.le.org/svnroot/isis-fish/data/branches/3.2

Returns:
remote repository url

isVersionnableFile

public boolean isVersionnableFile(File file)
Description copied from interface: VCS
Check if file can be put in vcs repository. For example when you used CVS, you must not put CVS file.

default refused .svn, CVS and ~ filename Must be override, this default implementation return true.

Specified by:
isVersionnableFile in interface VCS
Overrides:
isVersionnableFile in class AbstractVCS
Returns:
true if file is versionnable

cleanup

public void cleanup(File path)
             throws VCSException
Cleanup a directory, removing all lock. Perform a "svn cleanup" command.

Parameters:
path - path to cleanup
Throws:
VCSException

commit

public void commit(List<File> files,
                   String msg)
            throws VCSException
Commit specified files, if files is null, all files are committed.

Parameters:
files - files to commit
msg - message used to commit
Throws:
VCSException

commitWithoutCheck

protected void commitWithoutCheck(List<File> files,
                                  String msg)
                           throws VCSException
Commit without ask for registred listeners.

Parameters:
files - files to commit
msg - message for commit
Throws:
VCSException

add

public void add(List<File> files,
                String msg)
         throws VCSException
Perform : - svn add - commit

Parameters:
files - list of file to add
msg - message for commit
Throws:
VCSException

checkout

public void checkout(org.nuiton.util.Version tag,
                     boolean recurse)
              throws VCSException
Description copied from interface: VCS
get repository on server and put it in localdir.

Parameters:
tag - tag to used, null = /trunk other is tags/[tag]
recurse - if file is directory checkout sub file
Throws:
VCSException

delete

public void delete(List<File> files,
                   String msg)
            throws VCSException
Description copied from interface: VCS
Delete and commit files in server repository.

Parameters:
files - file to delete
msg - message for commit
Throws:
VCSException

getLocalStatus

public VCS.Status getLocalStatus(File file)
                          throws VCSException
Description copied from interface: VCS
Get file local status.

Parameters:
file - file to get status
Returns:
file status
Throws:
VCSException

getLocalStatus

protected Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getLocalStatus(File file,
                                                                       boolean recurse,
                                                                       org.tmatesoft.svn.core.wc.SVNStatusType... wanted)
                                                                throws VCSException
Recherche le statut des fichiers locaux, ne retourne jamais les fichiers NORMAL ou NONE sauf si demandé explicitement via wanted

Parameters:
file - le repertoire a partir duquel on souhaite le status
recurse - si l'on souhaite le faire recursivement
wanted - l'ensemble des status type que l'on recheche, si vide recherche tous les statuts
Returns:
une map avec comme cle le File local et en valeur le status
Throws:
VCSException

getRemoteStatus

protected Map<File,org.tmatesoft.svn.core.wc.SVNStatus> getRemoteStatus(File file,
                                                                        boolean recurse,
                                                                        org.tmatesoft.svn.core.wc.SVNStatusType... wanted)
                                                                 throws VCSException
Parameters:
file -
recurse -
wanted -
Returns:
remote status
Throws:
VCSException

getChanglog

public Map<File,String> getChanglog(List<File> files)
                             throws VCSException
Return all changelog between local file version and remote repository file version.

Parameters:
files -
Returns:
changelog for each file
Throws:
VCSException

getDiff

public String getDiff(File file)
               throws VCSException
show diff between local file and repository file.

Parameters:
file - file to get diff
Returns:
string diff
Throws:
VCSException

getFileList

public List<String> getFileList(File directory)
                         throws VCSException
Description copied from interface: VCS
Return list of all file on directory on remote server.

Returns:
files list
Throws:
VCSException

getUpdatedFile

public List<File> getUpdatedFile()
                          throws VCSException
get list of new or modified files on server.

Returns:
list of modified or new files
Throws:
VCSException

haveUpdate

public boolean haveUpdate()
                   throws VCSException
Ask if there are some new or modified files on server.

Returns:
true if new file available
Throws:
VCSException

isOnRemote

public boolean isOnRemote(File file)
                   throws VCSException
Check if file is available on server.

Parameters:
file - file to check
Returns:
true if file available
Throws:
VCSException

isUpToDate

public boolean isUpToDate(File file)
                   throws VCSException
Check if file is uptodate.

Parameters:
file - file to check
Returns:
true if file is in last version
Throws:
VCSException

update

public List<File> update(File file,
                         boolean recurse)
                  throws VCSException
Description copied from interface: VCS
Update file.

Parameters:
file - files to update
Returns:
true if there are some merging conflict, false otherwise
Throws:
VCSException

isWriteable

public boolean isWriteable()
                    throws VCSException
Description copied from interface: VCS
Return true, if local repository is writable. (use trunk and is not anonymous)

Returns:
writable
Throws:
VCSException

isTag

public boolean isTag(org.nuiton.util.Version version)
              throws VCSException
Description copied from interface: VCS
Look on server if version is tag repository.

Parameters:
version - version number like 3.2
Returns:
true if tag found with this name
Throws:
VCSException

getTag

public String getTag()
              throws VCSException
Description copied from interface: VCS
Retourne le tag reellement utilise, par exemple si on a fait un setTag(3.2.0) cette methode retourne "/tags/3.2.0", pour setTag(null) on retourne "/trunk"

Returns:
tag
Throws:
VCSException

setTag

public List<File> setTag(org.nuiton.util.Version version)
                  throws VCSException
Description copied from interface: VCS
Change repository tag, used when we use some tag and we want to go to trunk.

Parameters:
version - version to go, if null trunk is used, otherwize tags/version is used
Returns:
a list of all file in conflict
Throws:
VCSException


Copyright © 1999-2011 CodeLutin. All Rights Reserved.