use of org.netbeans.lib.cvsclient.connection.AbstractConnection in project maven-scm by apache.
the class CvsConnection method connect.
/**
* Creates the connection and the client and connects.
*/
private void connect(CVSRoot root, String password) throws AuthenticationException, CommandAbortedException {
if (CVSRoot.METHOD_EXT.equals(root.getMethod())) {
String cvsRsh = System.getProperty("maven.scm.cvs.java.cvs_rsh");
if (cvsRsh == null) {
try {
cvsRsh = CommandLineUtils.getSystemEnvVars().getProperty("CVS_RSH");
} catch (IOException e) {
// we assume searching env var can't fail
}
}
if (cvsRsh != null) {
if (cvsRsh.indexOf(' ') < 0) {
// cvs_rsh should be 'rsh' or 'ssh'
// Complete the command to use
String username = root.getUserName();
if (username == null) {
username = System.getProperty("user.name");
}
cvsRsh += " " + username + "@" + root.getHostName() + " cvs server";
}
AbstractConnection conn = new org.netbeans.lib.cvsclient.connection.ExtConnection(cvsRsh);
conn.setRepository(root.getRepository());
connection = conn;
} else {
connection = new ExtConnection(root);
}
} else {
connection = ConnectionFactory.getConnection(root);
if (CVSRoot.METHOD_PSERVER.equals(root.getMethod())) {
((PServerConnection) connection).setEncodedPassword(password);
}
}
connection.open();
client = new Client(connection, new StandardAdminHandler());
client.setLocalPath(localPath);
}
Aggregations