Class PasswordPolicyImpl
- java.lang.Object
-
- org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl
-
- All Implemented Interfaces:
PasswordPolicy
,Control
public class PasswordPolicyImpl extends Object implements PasswordPolicy
A simplePasswordPolicy
Control implementation.- Version:
- $Rev$, $Date$
- Author:
- Apache Directory Project
-
-
Field Summary
-
Fields inherited from interface org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy
OID
-
-
Constructor Summary
Constructors Constructor Description PasswordPolicyImpl()
Creates a new instance of a PasswordPolicy request Control without any response data associated with it.PasswordPolicyImpl(boolean hasResponse)
Creates a new instance of a PasswordPolicy request Control without any response data associated with it.PasswordPolicyImpl(PasswordPolicyResponse response)
Creates a new instance of PasswordPolicy response Control with response information packaged into the control.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getOid()
PasswordPolicyResponse
getResponse()
Get's the response component of this control if this control carries a response.boolean
hasResponse()
Checks whether this Control is the password policy request or the response by carrying with it an IPasswordPolicyResponse object.boolean
isCritical()
Tells if the control is critical or not.void
setCritical(boolean isCritical)
Sets the critical flag which determines whether or not this control is critical for the correct operation of a request or response message.PasswordPolicyResponse
setResponse(boolean hasResponse)
If true sets the response to a default newly initialized response object.void
setResponse(PasswordPolicyResponse response)
Sets the response.String
toString()
Get a String representation of a PasswordPolicyImpl
-
-
-
Constructor Detail
-
PasswordPolicyImpl
public PasswordPolicyImpl()
Creates a new instance of a PasswordPolicy request Control without any response data associated with it.
-
PasswordPolicyImpl
public PasswordPolicyImpl(boolean hasResponse)
Creates a new instance of a PasswordPolicy request Control without any response data associated with it.- Parameters:
hasResponse
- A flag set to true if the control should have a response
-
PasswordPolicyImpl
public PasswordPolicyImpl(PasswordPolicyResponse response)
Creates a new instance of PasswordPolicy response Control with response information packaged into the control.- Parameters:
response
- The encapsulated response
-
-
Method Detail
-
isCritical
public boolean isCritical()
Tells if the control is critical or not.- Specified by:
isCritical
in interfaceControl
- Returns:
true
if the control is critical,false
otherwise
-
setCritical
public void setCritical(boolean isCritical)
Sets the critical flag which determines whether or not this control is critical for the correct operation of a request or response message. The default for this value should be false.- Specified by:
setCritical
in interfaceControl
- Parameters:
isCritical
- true if the control is critical false otherwise.
-
setResponse
public void setResponse(PasswordPolicyResponse response)
Sets the response. If null hasResponse() will return null and this will be handled as a password policy request control rather than a response control.- Specified by:
setResponse
in interfacePasswordPolicy
- Parameters:
response
- a valid response object, or null to make this a request
-
hasResponse
public boolean hasResponse()
Checks whether this Control is the password policy request or the response by carrying with it an IPasswordPolicyResponse object. If it is a request, then no response component will be associated with the control: getResponse() will return null.- Specified by:
hasResponse
in interfacePasswordPolicy
- Returns:
- true if this Control carries a response, false if it is a request
-
setResponse
public PasswordPolicyResponse setResponse(boolean hasResponse)
If true sets the response to a default newly initialized response object. If this was previously a request, it automatically becomes a response. If it was not a request with an already existing response object then that response is replace with a new one and the old is returned. If false then any response object set will be cleared to null. Effectively this will cause hasResponse() to return whatever you plug into it.- Specified by:
setResponse
in interfacePasswordPolicy
- Parameters:
hasResponse
- true to create default response, false to clear it- Returns:
- the old response object, if one did not exist null is returned
-
getResponse
public PasswordPolicyResponse getResponse()
Get's the response component of this control if this control carries a response. IfPasswordPolicy.hasResponse()
returns true, this will return a non-null policy response object.- Specified by:
getResponse
in interfacePasswordPolicy
- Returns:
- a non-null policy response or null, if
PasswordPolicy.hasResponse()
returns false
-
-