allensoft.javacvs.client
Class DefaultConnectionManager

java.lang.Object
  |
  +--allensoft.javacvs.client.DefaultConnectionManager
All Implemented Interfaces:
CVSConnectionManager
Direct Known Subclasses:
BrowserConnectionManager

public class DefaultConnectionManager
extends java.lang.Object
implements CVSConnectionManager

Creates connections to repository locations.


Inner Class Summary
protected static interface DefaultConnectionManager.ConnectionInstantiator
          Interface used by createLoginConnection method to instantiate a connection with some login details.
 
Constructor Summary
DefaultConnectionManager()
          Creates a new DefaultConnectionManager.
 
Method Summary
 CVSConnection createConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
          Creates a connection for the specified repository location.
protected  CVSConnection createExtConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
           
protected  CVSConnection createExternalRSHConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
           
protected  CVSConnection createExternalSSHConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
           
protected  CVSConnection createInternalSSHConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
           
protected  CVSConnection createLocalConnection(CVSClient client, RepositoryLocation location)
           
protected  CVSConnection createLoginConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager, DefaultConnectionManager.ConnectionInstantiator instantiator)
          Creates a connection to the supplied location.
protected  CVSConnection createPServerConnection(CVSClient client, RepositoryLocation location, LoginManager loginManager)
           
protected  java.lang.String getExtCommand(java.lang.String sPattern, RepositoryLocation location)
          Gets the external command that should be used for the supplied repository location given the command pattern.
 java.lang.String getExternalRSHCommand(RepositoryLocation location)
           
 java.lang.String getExternalRSHCommandPattern()
           
 java.lang.String getExternalSSHCommand(RepositoryLocation location)
           
 java.lang.String getExternalSSHCommandPattern()
           
 java.lang.String getLocalServerCommand()
          Gets the command that is used to run the local server.
protected  RepositoryDetails getRepositoryDetailsForExtConnection(RepositoryLocation location)
          Gets the repository details for the supplied location.
 void setExternalRSHCommandPattern(java.lang.String s)
           
 void setExternalSSHCommandPattern(java.lang.String s)
           
 void setLocalServerCommand(java.lang.String sCommand)
          Sets the command that is used to run the local server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConnectionManager

public DefaultConnectionManager()
Creates a new DefaultConnectionManager.
Method Detail

createConnection

public CVSConnection createConnection(CVSClient client,
                                      RepositoryLocation location,
                                      LoginManager loginManager)
                               throws CVSConnectionException
Creates a connection for the specified repository location. If a login is required then use the supplied login manager to get the login details from the user.
Specified by:
createConnection in interface CVSConnectionManager

createLocalConnection

protected CVSConnection createLocalConnection(CVSClient client,
                                              RepositoryLocation location)
                                       throws CVSConnectionException

createExtConnection

protected CVSConnection createExtConnection(CVSClient client,
                                            RepositoryLocation location,
                                            LoginManager loginManager)
                                     throws CVSConnectionException

createInternalSSHConnection

protected CVSConnection createInternalSSHConnection(CVSClient client,
                                                    RepositoryLocation location,
                                                    LoginManager loginManager)
                                             throws CVSConnectionException

createExternalSSHConnection

protected CVSConnection createExternalSSHConnection(CVSClient client,
                                                    RepositoryLocation location,
                                                    LoginManager loginManager)
                                             throws CVSConnectionException

createExternalRSHConnection

protected CVSConnection createExternalRSHConnection(CVSClient client,
                                                    RepositoryLocation location,
                                                    LoginManager loginManager)
                                             throws CVSConnectionException

getRepositoryDetailsForExtConnection

protected RepositoryDetails getRepositoryDetailsForExtConnection(RepositoryLocation location)
                                                          throws CVSConnectionException
Gets the repository details for the supplied location. This is required for creating ext and server connections. By default this just return RepositoryDetails.get(location). However, subclasses may like to define a different behaviour. For example, if details have not yet been defined then may be in the case of a GUI interface it would be nice to ask the user to decide how they want to connect.
Returns:
null if no details have been created yet or the details of how to connect.

createPServerConnection

protected CVSConnection createPServerConnection(CVSClient client,
                                                RepositoryLocation location,
                                                LoginManager loginManager)
                                         throws CVSConnectionException

createLoginConnection

protected CVSConnection createLoginConnection(CVSClient client,
                                              RepositoryLocation location,
                                              LoginManager loginManager,
                                              DefaultConnectionManager.ConnectionInstantiator instantiator)
                                       throws CVSConnectionException
Creates a connection to the supplied location. The user is only asked for a password if the password hasn't been cached before or if the cached password is invalid.

getLocalServerCommand

public java.lang.String getLocalServerCommand()
Gets the command that is used to run the local server. This is "cvs server" by default.

setLocalServerCommand

public void setLocalServerCommand(java.lang.String sCommand)
Sets the command that is used to run the local server. This is "cvs server" by default.

getExtCommand

protected java.lang.String getExtCommand(java.lang.String sPattern,
                                         RepositoryLocation location)
Gets the external command that should be used for the supplied repository location given the command pattern. The command pattern can contain %h and %u which will be substituted with the host name and user name respectively.

getExternalSSHCommand

public java.lang.String getExternalSSHCommand(RepositoryLocation location)

getExternalSSHCommandPattern

public java.lang.String getExternalSSHCommandPattern()

setExternalSSHCommandPattern

public void setExternalSSHCommandPattern(java.lang.String s)

getExternalRSHCommand

public java.lang.String getExternalRSHCommand(RepositoryLocation location)

getExternalRSHCommandPattern

public java.lang.String getExternalRSHCommandPattern()

setExternalRSHCommandPattern

public void setExternalRSHCommandPattern(java.lang.String s)