| | |
| | | public UserData createUserData() { |
| | | UserData ud = new UserData(); |
| | | ud.setServerLocation(getDefaultServerLocation()); |
| | | initializeUserDataWithUserArguments(ud, getUserArguments()); |
| | | return ud; |
| | | } |
| | | |
| | | private void initializeUserDataWithUserArguments(UserData ud, |
| | | String[] userArguments) |
| | | { |
| | | for (int i=0; i<userArguments.length; i++) |
| | | { |
| | | if (userArguments[i].equalsIgnoreCase("--connectTimeout")) |
| | | { |
| | | if (i < userArguments.length - 1) |
| | | { |
| | | String sTimeout = userArguments[i+1]; |
| | | try |
| | | { |
| | | ud.setConnectTimeout(new Integer(sTimeout)); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error getting connect timeout: "+t, t); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | ApplicationTrustManager trustManager = getTrustManager(); |
| | | trustManager.setHost(auth.getHostName()); |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | else |
| | | { |
| | | ctx = createLdapContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null); |
| | | getConnectTimeout(), null); |
| | | } |
| | | |
| | | ADSContext adsContext = new ADSContext(ctx); |
| | |
| | | ApplicationTrustManager trustManager = getTrustManager(); |
| | | trustManager.setHost(auth.getHostName()); |
| | | remoteCtx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | else |
| | | { |
| | | remoteCtx = createLdapContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null); |
| | | getConnectTimeout(), null); |
| | | } |
| | | adsContext = new ADSContext(remoteCtx); // adsContext owns remoteCtx |
| | | |
| | |
| | | try |
| | | { |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | dn = ADSContext.getAdministratorDN(dn); |
| | | effectiveDn[0] = dn; |
| | | ctx = createLdapsContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null, trustManager); |
| | | getConnectTimeout(), null, trustManager); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | type = SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; |
| | | } |
| | | lastLoadedCache = new TopologyCache(adsContext, trustManager); |
| | | lastLoadedCache = new TopologyCache(adsContext, trustManager, |
| | | getConnectTimeout()); |
| | | LinkedHashSet<PreferredConnection> cnx = |
| | | new LinkedHashSet<PreferredConnection>(); |
| | | cnx.add(PreferredConnection.getPreferredConnection( |
| | |
| | | String dn = getUserData().getDirectoryManagerDn(); |
| | | String pwd = getUserData().getDirectoryManagerPwd(); |
| | | return createLdapsContext(ldapUrl, dn, pwd, |
| | | getDefaultLDAPTimeout(), null, null); |
| | | getConnectTimeout(), null, null); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | server.setAdsProperties(adsProperties); |
| | | } |
| | | return getRemoteConnection(server, auth.getDn(), auth.getPwd(), |
| | | trustManager, cnx); |
| | | return getRemoteConnection(server, auth.getDn(), auth.getPwd(), |
| | | trustManager, getConnectTimeout(), cnx); |
| | | } |
| | | |
| | | /** |
| | |
| | | lastImportProgress = parsedMessage; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the timeout to be used to connect in milliseconds. |
| | | * @return the timeout to be used to connect in milliseconds. Returns |
| | | * {@code 0} if there is no timeout. |
| | | */ |
| | | protected int getConnectTimeout() |
| | | { |
| | | return getUserData().getConnectTimeout(); |
| | | } |
| | | } |
| | | |
| | | /** |