Search in sources :

Example 1 with AbstractConnection

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);
}
Also used : StandardAdminHandler(org.netbeans.lib.cvsclient.admin.StandardAdminHandler) AbstractConnection(org.netbeans.lib.cvsclient.connection.AbstractConnection) IOException(java.io.IOException) Client(org.netbeans.lib.cvsclient.Client) PServerConnection(org.netbeans.lib.cvsclient.connection.PServerConnection)

Aggregations

IOException (java.io.IOException)1 Client (org.netbeans.lib.cvsclient.Client)1 StandardAdminHandler (org.netbeans.lib.cvsclient.admin.StandardAdminHandler)1 AbstractConnection (org.netbeans.lib.cvsclient.connection.AbstractConnection)1 PServerConnection (org.netbeans.lib.cvsclient.connection.PServerConnection)1