1 22 23 package org.netbeans.lib.cvsclient.connection; 24 25 import org.netbeans.lib.cvsclient.CVSRoot; 26 27 33 public class ConnectionFactory { 34 35 38 protected ConnectionFactory() {} 39 40 49 public static Connection getConnection(String cvsRoot) throws IllegalArgumentException { 50 51 CVSRoot root = CVSRoot.parse(cvsRoot); 52 return getConnection(root); 53 54 } 55 56 65 public static Connection getConnection(CVSRoot root) throws IllegalArgumentException { 66 67 if (root.isLocal()) { 69 LocalConnection con = new LocalConnection(); 70 con.setRepository(root.getRepository()); 71 return con; 72 } 73 74 String method = root.getMethod(); 75 88 89 if (CVSRoot.METHOD_PSERVER == method) { 91 PServerConnection con = new PServerConnection(root); 92 return con; 93 } 94 95 throw new IllegalArgumentException ("Unrecognized CVS Root: " + root); 96 97 } 98 99 } 100 | Popular Tags |