Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * ====================================================================
   * Copyright (c) 2004-2006 TMate Software Ltd.  All rights reserved.
   *
   * This software is licensed as described in the file COPYING, which
   * you should have received as part of this distribution.  The terms
   * are also available at http://svnkit.com/license.html
   * If newer versions of this license are posted there, you may use a
   * newer version instead, at your option.
  * ====================================================================
  */
 package org.tmatesoft.svn.core.io;


The ISVNSession interface provides some extra handling operations over SVNRepository objects.

For remote accessing a repository (via svn:// and http://) SVNRepository drivers open socket connections to write and read data from. Session objects (implementing ISVNSession) may enable an SVNRepository object to use a single socket connection during the whole runtime, or, as an alternative, to use a new socket connection per each repository access operation (this slows the speed of operation execution since the operation needs some extra time for opening and closing a socket).

Also ISVNSession allows to cache and retrieve commit messages during runtime.

How to set a session object for an SVNRepository driver:

 import org.tmatesoft.svn.core.io.ISVNSession;
 import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
 import org.tmatesoft.svn.core.io.SVNRepository;
 import org.tmatesoft.svn.core.SVNURL;
 ...
 
     ISVNSession session;
     ...
     SVNURL url = SVNURL.parseURIEncoded("svn://host/path/to/repos");
     try{
         SVNRepository repository = SVNRepositoryFactory.create(url, session);
         ...
     }catch(SVNException svne){
         ...
     }

Author(s):
TMate Software Ltd.
Version:
1.1.0
See also:
SVNRepository
SVNRepositoryFactory
 
 public interface ISVNSession {
    
Says if the given SVNRepository object should use a single socket connection (not to open/close a new one for each operation). This will certainly improve the SVNRepository object's methods performance speed.

For examlpe, a session object may hold a number of SVNRepository object references knowing for everyone of them if it should keep a single connection or not.

Parameters:
repository an SVNRepository driver
Returns:
true if repository should use a single socket connection during the whole runtime, false - to open/close a new connection for each repository access operation
 
     public boolean keepConnection(SVNRepository repository);
    
    
Caches a commit message for the given revision.

Parameters:
repository an SVNRepository driver (to distinguish that repository for which this message is actual)
revision a revision number
message the commit message for revision
See also:
getCommitMessage(org.tmatesoft.svn.core.io.SVNRepository,long)
 
     public void saveCommitMessage(SVNRepository repositorylong revisionString message);

    
Retrieves the cached commit message for a particular revision. Use getCommitMessage() to check if there's a message in cache.

Parameters:
repository an SVNRepository driver (to distinguish that repository for which a commit message is requested)
revision a revision number
Returns:
the commit message for revision
See also:
saveCommitMessage(org.tmatesoft.svn.core.io.SVNRepository,long,java.lang.String)
 
     public String getCommitMessage(SVNRepository repositorylong revision);
    
    
Checks if there's a commit message in cache for a particular repository and revision.

Parameters:
repository an SVNRepository driver (to distinguish that repository for which a commit message is requested)
revision a revision number
Returns:
true if the cache has got a message for the given repository and revision, false otherwise
    public boolean hasCommitMessage(SVNRepository repositorylong revision);
    
    
A session options implementation that simply allows to keep a single connection alive for all data i/o. This implementation does not cache commit messages.
    public ISVNSession KEEP_ALIVE = new ISVNSession() {
        public boolean keepConnection(SVNRepository repository) {
            return true;
        }
        public void saveCommitMessage(SVNRepository repositorylong revisionString message) {
        }
        public String getCommitMessage(SVNRepository repositorylong revision) {
            return null;
        }
        public boolean hasCommitMessage(SVNRepository repositorylong revision) {
            return false;
        }
    };

    
The same as KEEP_ALIVE. Left for backward compatibility.
    public ISVNSession DEFAULT = ;
New to GrepCode? Check out our FAQ X