ldapConstraints = new LDAPConstraints(); ldapConstraints.setReferralFollowing(confService.getFollowReferrals()); ldapConstraints.setReferralHandler(new ReferralAuthHandler(userDN, password)); ldapConstraints.setHopLimit(confService.getMaxReferralHops()); ldapConstraints.setTimeLimit(confService.getOperationTimeout() * 1000);
/** * Applies <code>LDAPConstraints</code> * to the specified <code>LDAPConnection</code>. * Implemented to assign <code>timeLimit</code> and * <code>referralFollowing</code> constraint values * retrieved from the currently assigned * {@link LdapConnectionManagerConfig}. * * @param conn */ protected void applyConstraints(LDAPConnection conn) { int timeout = config.getOperationTimeout(); boolean followReferrals = config.isFollowReferrals(); if ( log.isDebugEnabled() ) { log.debug("applyConstraints(): values [timeout = " + timeout + "][follow referrals = " + followReferrals + "]"); } LDAPConstraints constraints = new LDAPConstraints(); constraints.setTimeLimit(timeout); constraints.setReferralFollowing(followReferrals); conn.setConstraints(constraints); }
constraints.setTimeLimit(1000); constraints.setReferralFollowing(true); constraints.setReferralHandler(new LDAPPluginReferralHandler(loginDN, password, context)); this.connection.setConstraints(constraints);
/** * Constructs a new LDAPConstraints object, using the specified * operational constraints for waiting, referrals, LDAPBindHandler * object, and hop limit. * * @see com.novell.ldap.LDAPConstraints#LDAPConstraints( int,boolean,LDAPReferralHandler,int) * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#LDAPConstraints(int, boolean, com.novell.ldap.LDAPReferralHandler, int)"> com.novell.ldap.LDAPConstraints.LDAPConstraints(int, boolean, LDAPReferralHandler, int)</a> */ public LDAPConstraints(int msLimit, boolean doReferrals, LDAPReferralHandler handler, int hop_limit) { // Set defaults for search parameters this.cons = new com.novell.ldap.LDAPSearchConstraints(); // Set values for base constraints this.cons.setTimeLimit( msLimit); this.cons.setReferralFollowing( doReferrals); this.cons.setHopLimit( hop_limit); setReferralHandler( handler); return; }
super( cons.getTimeLimit(), cons.getReferralFollowing(), cons.getReferralHandler(), cons.getHopLimit()); LDAPControl[] lsc = cons.getControls(); if( lsc != null) { super.setControls((LDAPControl[])lsc.clone()); Hashtable lp = cons.getProperties(); if( lp != null) { super.setProperties( (Hashtable)lp.clone());
defSearchCons = (LDAPSearchConstraints)cons.clone(); return; newCons.setHopLimit(cons.getHopLimit()); newCons.setTimeLimit(cons.getTimeLimit()); newCons.setReferralHandler(cons.getReferralHandler()); newCons.setReferralFollowing(cons.getReferralFollowing()); LDAPControl[] lsc = cons.getControls(); if( lsc != null) { newCons.setControls( lsc);
cons = defSearchCons; LDAPMessage msg = new LDAPDeleteRequest( dn, cons.getControls()); return sendRequestToServer(msg, cons.getTimeLimit(), queue, null);
/** * Specifies whether referrals are followed automatically or whether * referrals throw an LDAPReferralException. * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#setReferralFollowing(boolean)"> com.novell.ldap.LDAPConstraints.setReferralFollowing(boolean)</a> */ public void setReferralFollowing(boolean doReferrals) { cons.setReferralFollowing(doReferrals); return; }
/** * Sets the maximum number of milliseconds the client waits for * any operation under these search constraints to complete. * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#setTimeLimit(int)"> com.novell.ldap.LDAPConstraints.setTimeLimit(int)</a> */ public void setTimeLimit(int msLimit) { cons.setTimeLimit(msLimit); return; }
/** * Returns the controls to be sent to the server. * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#getControls()"> com.novell.ldap.LDAPConstraints.getControls()</a> */ public LDAPControl[] getControls() { com.novell.ldap.LDAPControl[] controls = cons.getControls(); if( controls == null) { return null; } LDAPControl[] ietfControls = new LDAPControl[controls.length]; for( int i=0; i < controls.length; i++) { ietfControls[i] = new LDAPControl( controls[i]); } return ietfControls; }
/** * Specifies the object that will process authentication requests. * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#setReferralHandler(com.novell.ldap.LDAPReferralHandler)"> com.novell.ldap.LDAPConstraints.setReferralHandler( LDAPReferralHandler)</a> */ public void setReferralHandler(LDAPReferralHandler handler) { if( handler == null) { cons.setReferralHandler((com.novell.ldap.LDAPReferralHandler)null); refHandler = null; } else if( handler instanceof LDAPBindHandler) { refHandler = new BindHandlerImpl( (LDAPBindHandler)handler); cons.setReferralHandler( refHandler); } else if( handler instanceof LDAPAuthHandler) { refHandler = new AuthHandlerImpl( (LDAPAuthHandler)handler); cons.setReferralHandler( refHandler); } else { throw new IllegalArgumentException( "LDAPReferralHandler object must be either LDAPAuthHandler or LDAPBindHandler"); } return; }
/** * Sets the maximum number of hops to follow in sequence during * automatic referral following. * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#setHopLimit(int)"> com.novell.ldap.LDAPConstraints.setHopLimit(int)</a> */ public void setHopLimit(int hop_limit) { cons.setHopLimit(hop_limit); return; }
/** * Creates a clone of this object * * @return a clone of this object * * @see <a href="../../../../api/com/novell/ldap/LDAPConstraints.html#clone()">com.novell.ldap.LDAPConstraints.clone()</a> */ public Object clone() { try { Object newObj = super.clone(); ((LDAPConstraints)newObj).cons = (com.novell.ldap.LDAPConstraints)this.cons.clone(); return newObj; } catch( CloneNotSupportedException ce) { throw new RuntimeException("Internal error, cannot create clone"); } } /**
standardConstraints = new LDAPConstraints(); standardConstraints.setTimeLimit(connectionManager.getConfig().getOperationTimeout()); standardConstraints.setReferralFollowing(connectionManager.getConfig().isFollowReferrals());
cons = defSearchCons; LDAPMessage msg = new LDAPModifyRequest( dn, mods, cons.getControls()); return sendRequestToServer(msg, cons.getTimeLimit(), queue, null);
public void add(LDAPEntry entry, LDAPConstraints cont) throws LDAPException { LDAPControl[] conts = cont != null ? cont.getControls() : null; LDAPAddRequest add = new LDAPAddRequest(entry,conts); this.sendMessage(add); }
LDAPMessage msg = new LDAPAddRequest( entry, cons.getControls()); return sendRequestToServer(msg, cons.getTimeLimit(), queue, null);
public void modify( String dn, LDAPModification[] mods, LDAPConstraints consts) throws LDAPException { LDAPControl[] controls = consts != null ? consts.getControls() : null; LDAPModifyRequest msg = new LDAPModifyRequest(dn,mods,controls); this.sendMessage(msg); }
deleteOldRdn, cons.getControls()); return sendRequestToServer(msg, cons.getTimeLimit(), queue, null);
public void delete(String dn, LDAPConstraints consts) throws LDAPException { LDAPControl[] controls = consts != null ? consts.getControls() : null; LDAPDeleteRequest msg = new LDAPDeleteRequest(dn,controls); this.sendMessage(msg); }