/** * Create a new connection using the information specified in the * {@code prefs}. * * @param prefs a {@link ConcourseClientPreferences prefs} handler * @return the connection */ public static Concourse connectWithPrefs(ConcourseClientPreferences prefs) { return connect(prefs.getHost(), prefs.getPort(), prefs.getUsername(), String.valueOf(prefs.getPassword()), prefs.getEnvironment()); }
/** * Return a {@link ConnectionPool} that has no limit on the number of * connections it can manage to the Concourse instance at {@code host}: * {@code port} on behalf of the user identified by {@code username} and * {@code password}, but will try to use previously created connections * before establishing new ones for any request. * * @param prefs * @return the ConnectionPool */ public static ConnectionPool newCachedConnectionPool(String prefs) { ConcourseClientPreferences cp = ConcourseClientPreferences .from(Paths.get(prefs)); return new CachedConnectionPool(cp.getHost(), cp.getPort(), cp.getUsername(), new String(cp.getPassword()), cp.getEnvironment(), DEFAULT_POOL_SIZE); }
/** * Return a new {@link ConnectionPool} with a fixed number of * connections to the Concourse instance defined in the client {@code prefs} * on behalf of the user defined in the client {@code prefs}. * <p> * If all the connections from the pool are active, subsequent request * attempts will block until a connection is returned. * </p> * * @param prefs * @param poolSize * @return the ConnectionPool */ public static ConnectionPool newFixedConnectionPool(String prefs, int poolSize) { ConcourseClientPreferences cp = ConcourseClientPreferences .from(Paths.get(prefs)); return new FixedConnectionPool(cp.getHost(), cp.getPort(), cp.getUsername(), new String(cp.getPassword()), cp.getEnvironment(), poolSize); }
options.host = prefs.getHost(); options.port = prefs.getPort(); options.environment = prefs.getEnvironment();
opts.host = prefs.getHost(); opts.port = prefs.getPort(); opts.environment = prefs.getEnvironment();